Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement standalone mocha runner and loader #1

Merged
merged 28 commits into from
Apr 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
af988dd
refactor: Rebrand project for Mocha
Danielku15 Mar 24, 2024
0733d11
feat: Implement standalone mocha runner and loader
Danielku15 Mar 24, 2024
93fd534
chore: Extend tests
Danielku15 Mar 24, 2024
738e0b6
Merge branch 'main' into feature/mocha-standalone
Danielku15 Mar 31, 2024
088cfdc
Merge branch 'main' into feature/mocha-standalone
Danielku15 Mar 31, 2024
619f562
build: add test reports
Danielku15 Mar 31, 2024
1e2d0b4
build: Fix vscode DTS
Danielku15 Mar 31, 2024
372eb17
build: don't fail fast
Danielku15 Mar 31, 2024
6eeefd1
build: increase timeout of tests
Danielku15 Mar 31, 2024
105289c
build: Add test config printing
Danielku15 Mar 31, 2024
33f0174
build: explicit compile call
Danielku15 Mar 31, 2024
5ecc515
build: test output to check for files
Danielku15 Mar 31, 2024
c32cb75
build: fix improt
Danielku15 Mar 31, 2024
39d8693
build: Remove artifact name
Danielku15 Mar 31, 2024
0d7ac25
build: Permissions and matrix handling
Danielku15 Mar 31, 2024
a36d8e2
build: Align formatting of test results
Danielku15 Mar 31, 2024
5390451
chore: Cleanup and todo resolving
Danielku15 Mar 31, 2024
8d265a1
chore: some more logs
Danielku15 Mar 31, 2024
c3d6e1d
fix: Line numbers on typescript
Danielku15 Mar 31, 2024
8753898
chore: Use mocharc as root note text for clarity
Danielku15 Mar 31, 2024
f4cb19f
fix: zero-based columns
Danielku15 Mar 31, 2024
0aa66d7
fix: handle inconsistencies in source-map lib
Danielku15 Mar 31, 2024
9c25be6
fix: clear out test inconsistencies
Danielku15 Mar 31, 2024
c063976
fix: handle source mapped javascript
Danielku15 Mar 31, 2024
602308d
feat: add support for ignore patterns
Danielku15 Mar 31, 2024
93d84ec
Remove OpenJS foundation for now.
Danielku15 Apr 2, 2024
3f1ee6a
chore: Add note about extension to readme
Danielku15 Apr 2, 2024
5828c93
chore: add link to project.
Danielku15 Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: add test reports
Danielku15 committed Mar 31, 2024
commit 619f562f60b167d813d0f4cac5c79aff3880557e
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -26,3 +26,10 @@ jobs:
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
- uses: dorny/test-reporter@v1
if: always()
with:
artifact: test-results
name: VS Code Tests
path: 'test-results/*.json'
reporter: mocha-json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
test-results/*.json

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
19 changes: 19 additions & 0 deletions .vscode-ci-test-reporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const BaseReporter = require('mocha/lib/reporters/base');
const SpecReporter = require('mocha/lib/reporters/spec');
const JsonReporter = require('mocha/lib/reporters/json');

module.exports = class MultiReporter extends BaseReporter {
reporters;

constructor(runner, options) {
super(runner, options);
this.reporters = [
new SpecReporter(runner, {
reporterOption: options.reporterOption.specReporterOption,
}),
new JsonReporter(runner, {
reporterOption: options.reporterOption.jsonReporterOption,
}),
];
}
};
40 changes: 33 additions & 7 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -7,30 +7,56 @@ const dirname = fileURLToPath(new URL('.', import.meta.url));
const integrationTestDir = path.join(dirname, 'out/test/integration');
const workspaceBaseDir = path.join(dirname, 'test-workspaces');


const vsCodeVersion = process.env.VSCODE_TEST_VERSION ?? 'stable';
const vsCodePlatform = process.env.VSCODE_TEST_PLATFORM ?? 'desktop';

let createCommonOptions = (label) => {
if (process.env.GITHUB_ACTIONS) {
return {
platform: vsCodePlatform,
version: vsCodeVersion,
env: {
MOCHA_COLORS: 'true',
},
mocha: {
ui: 'bdd',

reporter: path.join(dirname, '.vscode-ci-test-reporter.js'),
reporterOption: {
jsonReporterOption: {
output: path.join(dirname, 'test-results', `${label}.json`),
},
},
},
};
} else {
return {
platform: vsCodePlatform,
version: vsCodeVersion,

mocha: {
ui: 'bdd',
},
};
}
};

export default defineConfig([
{
platform: vsCodePlatform,
version: vsCodeVersion,
label: 'unit',
files: 'out/test/unit/**/*.test.js',
mocha: { ui: 'bdd' },
...createCommonOptions('unit'),
},
...fs
.readdirSync(integrationTestDir)
.filter((f) => f.endsWith('.test.js'))
.map((file) => {
const label = path.basename(file, '.test.js');
return {
platform: vsCodePlatform,
version: vsCodeVersion,
label,
files: path.join(integrationTestDir, file),
mocha: { ui: 'bdd', timeout: 60_000 },
workspaceFolder: path.join(workspaceBaseDir, label),
...createCommonOptions(label),
};
}),
]);
115 changes: 41 additions & 74 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@
"@types/sinon": "^10.0.19",
"@types/split2": "^4.2.1",
"@types/yargs": "^17.0.32",
"@vscode/dts": "^0.4.0",
"@vscode/test-cli": "^0.0.8",
"@vscode/test-electron": "^2.3.9",
"acorn": "^8.10.0",
@@ -131,8 +132,7 @@
"prettier": "^3.0.3",
"sinon": "^16.1.0",
"tsx": "^4.7.1",
"typescript": "^5.2.2",
"vscode-dts": "^0.3.3"
"typescript": "^5.2.2"
},
"prettier": {
"printWidth": 100,
Loading