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

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/external-queries.test.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fingerprints.test.js

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
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

Lines changed: 9 additions & 7 deletions
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

Lines changed: 3 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy