Skip to content

Commit 572c8bb

Browse files
switch to using ava
1 parent 0347b72 commit 572c8bb

10 files changed

+304
-48
lines changed

lib/analysis-paths.test.js

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/external-queries.test.js

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fingerprints.test.js

+156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@
55
"description": "CodeQL action",
66
"scripts": {
77
"build": "tsc",
8-
"test": "jest",
8+
"test": "ava src/**",
99
"lint": "tslint -p . -c tslint.json 'src/**/*.ts'",
1010
"removeNPMAbsolutePaths": "removeNPMAbsolutePaths . --force"
1111
},
12+
"ava": {
13+
"typescript": {
14+
"rewritePaths": {
15+
"src/": "lib/"
16+
}
17+
}
18+
},
1219
"license": "MIT",
1320
"dependencies": {
1421
"@actions/core": "^1.0.0",

src/analysis-paths.test.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
import test from 'ava';
2+
13
import * as analysisPaths from './analysis-paths';
24
import * as configUtils from './config-utils';
35

4-
test("emptyPaths", async () => {
6+
test("emptyPaths", async t => {
57
let config = new configUtils.Config();
68
analysisPaths.includeAndExcludeAnalysisPaths(config, []);
7-
expect(process.env['LGTM_INDEX_INCLUDE']).toBeUndefined();
8-
expect(process.env['LGTM_INDEX_EXCLUDE']).toBeUndefined();
9+
t.is(process.env['LGTM_INDEX_INCLUDE'], undefined);
10+
t.is(process.env['LGTM_INDEX_EXCLUDE'], undefined);
911
});
1012

11-
test("nonEmptyPaths", async () => {
13+
test("nonEmptyPaths", async t => {
1214
let config = new configUtils.Config();
1315
config.paths.push('path1', 'path2');
1416
config.pathsIgnore.push('path3', 'path4');
1517
analysisPaths.includeAndExcludeAnalysisPaths(config, []);
16-
expect(process.env['LGTM_INDEX_INCLUDE']).toEqual('path1\npath2');
17-
expect(process.env['LGTM_INDEX_EXCLUDE']).toEqual('path3\npath4');
18-
});
18+
t.is(process.env['LGTM_INDEX_INCLUDE'], 'path1\npath2');
19+
t.is(process.env['LGTM_INDEX_EXCLUDE'], 'path3\npath4');
20+
});

src/external-queries.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import test from 'ava';
12
import * as fs from "fs";
23
import * as path from "path";
34

45
import * as configUtils from "./config-utils";
56
import * as externalQueries from "./external-queries";
67
import * as util from "./util";
78

8-
test("checkoutExternalQueries", async () => {
9+
test("checkoutExternalQueries", async t => {
910
let config = new configUtils.Config();
1011
config.externalQueries = [
1112
new configUtils.ExternalQuery("github/codeql-go", "df4c6869212341b601005567381944ed90906b6b"),
@@ -16,6 +17,6 @@ test("checkoutExternalQueries", async () => {
1617
await externalQueries.checkoutExternalQueries(config);
1718

1819
// COPYRIGHT file existed in df4c6869212341b601005567381944ed90906b6b but not in master
19-
expect(fs.existsSync(path.join(tmpDir, "github", "codeql-go", "COPYRIGHT"))).toBeTruthy();
20+
t.true(fs.existsSync(path.join(tmpDir, "github", "codeql-go", "COPYRIGHT")));
2021
});
2122
});

0 commit comments

Comments
 (0)