-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest-e2e-runner.js
More file actions
62 lines (54 loc) · 1.73 KB
/
jest-e2e-runner.js
File metadata and controls
62 lines (54 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* This file is a test-runner for vscode-test running on electron.
* Official Documentation: https://code.visualstudio.com/api/working-with-extensions/testing-extension#the-test-runner-script
*/
const { runCLI } = require('jest');
const path = require('path');
const fs = require('fs');
// const vscode = require('./vscode-module');
// const vscodePath = require.resolve('vscode');
// console.log('vscodePath=',vscodePath);
// vscode.window.showInformationMessage("I am the runner.");
// fs.readdirSync(path.join(__dirname, 'out/test/suite')).forEach(file => {
// console.log(file);
// });
console.log("I am in jest runner");
// console.log(`This is my Process ID: ${process.pid}`);
const options = {
// Specify Jest configuration options here
// You can also add a Jest config file path if needed
// testMatch: ['<rootDir>/out/**/*.test.js'], // Adjust according to your test structure
testMatch: ['<rootDir>/src/test/**/*.spec.js'], // Adjust according to your test structure
// runInBand: true,
// modulePaths: [
// "<rootDir>",
// ],
// moduleDirectories: [
// "node_modules"
// ],
moduleFileExtensions: [
"js",
],
verbose: true,
moduleNameMapper: {
// moogi: path.join(__dirname, "src", "test", "vscode-module.js"),
moogi: "<rootDir>/src/test/vscode-module.js",
},
testEnvironment: "./vscode-environment.js",
};
console.log("running");
module.exports.run = () => {
runCLI( options, [process.cwd()]).then(result => {
console.log(result);
if (result.success) {
console.log("Tests ran successfully!");
} else {
console.error("There were test failures.");
}
}).catch(error => {
console.error("Error running tests:", error);
});
}
if (require.main === module) {
module.exports.run();
}