Removing jest and replacing with vitest
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"Orta.vscode-jest",
|
"kingwl.vscode-vitest-runner",
|
||||||
"GitHub.copilot"
|
"GitHub.copilot"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
verbose: true,
|
|
||||||
transform: {
|
|
||||||
'^.+\\.(ts|tsx)?$': 'ts-jest'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Generated
+1142
-3034
File diff suppressed because it is too large
Load Diff
+5
-6
@@ -7,7 +7,7 @@
|
|||||||
"base-build": "npm ci && tsc",
|
"base-build": "npm ci && tsc",
|
||||||
"build": "npm run base-build && npm exec -- @vercel/ncc build --source-map lib/src/index.js",
|
"build": "npm run base-build && npm exec -- @vercel/ncc build --source-map lib/src/index.js",
|
||||||
"build-exe": "npm run build && pkg package.json --compress Gzip",
|
"build-exe": "npm run build && pkg package.json --compress Gzip",
|
||||||
"test": "jest"
|
"test": "vitest --run"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -22,20 +22,19 @@
|
|||||||
"homepage": "https://github.com/advanced-security/maven-dependency-submission-action",
|
"homepage": "https://github.com/advanced-security/maven-dependency-submission-action",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
|
"@actions/exec": "^1.1.1",
|
||||||
"@github/dependency-submission-toolkit": "^2.0.0",
|
"@github/dependency-submission-toolkit": "^2.0.0",
|
||||||
"commander": "^9.4.0",
|
"commander": "^9.4.0",
|
||||||
"packageurl-js": "^1.2.0"
|
"packageurl-js": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.1",
|
"@types/chai": "^4.3.1",
|
||||||
"@types/jest": "^28.1.6",
|
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
"jest": "^28.1.3",
|
|
||||||
"pkg": "^5.8.0",
|
"pkg": "^5.8.0",
|
||||||
"ts-jest": "^28.0.7",
|
"ts-node": "^10.9.2",
|
||||||
"ts-node": "^10.8.2",
|
"typescript": "^5.3.3",
|
||||||
"typescript": "^4.7.4"
|
"vitest": "^1.2.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"cli": "lib/src/executable/cli.js"
|
"cli": "lib/src/executable/cli.js"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { parseDependencyJson, MavenDependencyGraph } from './depgraph';
|
import { parseDependencyJson, MavenDependencyGraph } from './depgraph';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import {describe, it, beforeAll} from 'vitest';
|
||||||
|
|
||||||
describe('depgraph', () => {
|
describe('depgraph', () => {
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { PackageURL } from 'packageurl-js'
|
import { PackageURL } from 'packageurl-js'
|
||||||
import { PackageCache, Package, Manifest } from '@github/dependency-submission-toolkit';
|
import { PackageCache, Package, Manifest } from '@github/dependency-submission-toolkit';
|
||||||
import { DependencyScope } from '@github/dependency-submission-toolkit/dist/manifest';
|
import { DependencyScope } from '@github/dependency-submission-toolkit';
|
||||||
import { loadFileContents } from './utils/file-utils';
|
import { loadFileContents } from './utils/file-utils';
|
||||||
|
|
||||||
export type Depgraph = {
|
export type Depgraph = {
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { getMavenProjectDirectory, getMavenSettingsFile } from './utils/test-util';
|
import { getMavenProjectDirectory, getMavenSettingsFile } from './utils/test-util';
|
||||||
import { MavenRunner } from './maven-runner';
|
import { MavenRunner } from './maven-runner';
|
||||||
|
import {describe, it, expect} from 'vitest';
|
||||||
|
|
||||||
describe('maven-runner', () => {
|
describe('maven-runner', () => {
|
||||||
|
|
||||||
jest.setTimeout(20000);
|
|
||||||
|
|
||||||
describe('create', () => {
|
describe('create', () => {
|
||||||
|
|
||||||
it('should create a runner without a wrapper', async () => {
|
it('should create a runner without a wrapper', async () => {
|
||||||
@@ -16,7 +15,7 @@ describe('maven-runner', () => {
|
|||||||
expect(runner.configuration.executable).toBeDefined();
|
expect(runner.configuration.executable).toBeDefined();
|
||||||
expect(runner.configuration.executable).toBe('mvn');
|
expect(runner.configuration.executable).toBe('mvn');
|
||||||
expect(runner.configuration.settingsFile).toBeUndefined();
|
expect(runner.configuration.settingsFile).toBeUndefined();
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should create a runner with wrapper', async () => {
|
it('should create a runner with wrapper', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('maven-wrapper');
|
const projectDir = getMavenProjectDirectory('maven-wrapper');
|
||||||
@@ -26,7 +25,7 @@ describe('maven-runner', () => {
|
|||||||
expect(runner.configuration.executable).toBeDefined();
|
expect(runner.configuration.executable).toBeDefined();
|
||||||
expect(runner.configuration.executable).toBe(path.join(projectDir, 'mvnw'));
|
expect(runner.configuration.executable).toBe(path.join(projectDir, 'mvnw'));
|
||||||
expect(runner.configuration.settingsFile).toBeUndefined();
|
expect(runner.configuration.settingsFile).toBeUndefined();
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
describe('with settings', () => {
|
describe('with settings', () => {
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { getMavenProjectDirectory } from './utils/test-util';
|
import { getMavenProjectDirectory } from './utils/test-util';
|
||||||
import { generateDependencyGraph, generateSnapshot } from './snapshot-generator';
|
import { generateDependencyGraph, generateSnapshot } from './snapshot-generator';
|
||||||
|
import {describe, it, expect} from 'vitest';
|
||||||
|
|
||||||
describe('snapshot-generator', () => {
|
describe('snapshot-generator', () => {
|
||||||
|
|
||||||
jest.setTimeout(20000);
|
|
||||||
|
|
||||||
describe('#generateDependencyGraph()', () => {
|
describe('#generateDependencyGraph()', () => {
|
||||||
|
|
||||||
it('should generate a snapshot for a simple project', async () => {
|
it('should generate a snapshot for a simple project', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('simple');
|
const projectDir = getMavenProjectDirectory('simple');
|
||||||
const depGraph = await generateDependencyGraph(projectDir);
|
const depGraph = await generateDependencyGraph(projectDir);
|
||||||
expect(depGraph.dependencies.length).toBe(20);
|
expect(depGraph.dependencies.length).toBe(20);
|
||||||
});
|
}, 20000);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#generateSnapshot()', () => {
|
describe('#generateSnapshot()', () => {
|
||||||
@@ -24,7 +23,7 @@ describe('snapshot-generator', () => {
|
|||||||
|
|
||||||
expect(snapshot.manifests['bookstore-v3']).toBeDefined();
|
expect(snapshot.manifests['bookstore-v3']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should generate a snapshot for a multi-module project', async () => {
|
it('should generate a snapshot for a multi-module project', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('multi-module');
|
const projectDir = getMavenProjectDirectory('multi-module');
|
||||||
@@ -32,7 +31,7 @@ describe('snapshot-generator', () => {
|
|||||||
|
|
||||||
expect(snapshot.manifests['bs-parent']).toBeDefined();
|
expect(snapshot.manifests['bs-parent']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should generate a snapshot for a multi-module-multi-branch project', async () => {
|
it('should generate a snapshot for a multi-module-multi-branch project', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('multi-module-multi-branch');
|
const projectDir = getMavenProjectDirectory('multi-module-multi-branch');
|
||||||
@@ -41,7 +40,7 @@ describe('snapshot-generator', () => {
|
|||||||
expect(snapshot.manifests['bs-parent']).toBeDefined();
|
expect(snapshot.manifests['bs-parent']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
expect(snapshot.manifests['bs-parent'].countDependencies()).toBe(20);
|
expect(snapshot.manifests['bs-parent'].countDependencies()).toBe(20);
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should generate a snapshot for a maven-wrapper project', async () => {
|
it('should generate a snapshot for a maven-wrapper project', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('maven-wrapper');
|
const projectDir = getMavenProjectDirectory('maven-wrapper');
|
||||||
@@ -50,7 +49,7 @@ describe('snapshot-generator', () => {
|
|||||||
expect(snapshot.manifests['maven-wrapper-test']).toBeDefined();
|
expect(snapshot.manifests['maven-wrapper-test']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
expect(snapshot.manifests['maven-wrapper-test'].countDependencies()).toBe(0);
|
expect(snapshot.manifests['maven-wrapper-test'].countDependencies()).toBe(0);
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should generate a snapshot for an artifact with classifiers project', async () => {
|
it('should generate a snapshot for an artifact with classifiers project', async () => {
|
||||||
const projectDir = getMavenProjectDirectory('artifact-with-classifiers');
|
const projectDir = getMavenProjectDirectory('artifact-with-classifiers');
|
||||||
@@ -59,7 +58,7 @@ describe('snapshot-generator', () => {
|
|||||||
expect(snapshot.manifests['artifact-with-classifiers']).toBeDefined();
|
expect(snapshot.manifests['artifact-with-classifiers']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
expect(snapshot.manifests['artifact-with-classifiers'].countDependencies()).toBe(7);
|
expect(snapshot.manifests['artifact-with-classifiers'].countDependencies()).toBe(7);
|
||||||
});
|
}, 20000);
|
||||||
|
|
||||||
it('should process a problematic dependecy-tree 2602', async() => {
|
it('should process a problematic dependecy-tree 2602', async() => {
|
||||||
const projectDir = getMavenProjectDirectory('dependency-graph-2602');
|
const projectDir = getMavenProjectDirectory('dependency-graph-2602');
|
||||||
@@ -68,6 +67,6 @@ describe('snapshot-generator', () => {
|
|||||||
expect(snapshot.manifests['problem-dependency-graph-2602']).toBeDefined();
|
expect(snapshot.manifests['problem-dependency-graph-2602']).toBeDefined();
|
||||||
expect(snapshot.detector.version).toBe(version);
|
expect(snapshot.detector.version).toBe(version);
|
||||||
expect(snapshot.manifests['problem-dependency-graph-2602'].countDependencies()).toBe(230);
|
expect(snapshot.manifests['problem-dependency-graph-2602'].countDependencies()).toBe(230);
|
||||||
});
|
}, 20000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "CommonJS",
|
"module": "ES2020",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"sourceRoot": "./src",
|
"sourceRoot": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { defineConfig, mergeConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {}
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user