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

Rewrite release scripts and fixes #284

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@mochify/cli",
"version": "0.1.2",
"description": "Run mocha tests in headless browsers from the command line",
"homepage": "https://github.com/mantoni/mochify.js",
"bin": {
"mochify": "index.js"
},
Expand All @@ -10,6 +11,7 @@
"test": "echo \"No unit tests yet\"",
"test:integration": "mocha --timeout 10000 -R spec '**/*.integration.js'",
"preversion": "npm run test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions driver-jsdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"name": "@mochify/driver-jsdom",
"version": "0.1.1",
"description": "JSDom driver for Mochify",
"homepage": "https://github.com/mantoni/mochify.js",
"main": "index.js",
"scripts": {
"test": "echo \"No unit tests yet\"",
"test:integration": "echo \"No integration tests yet\"",
"preversion": "npm test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions driver-playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"name": "@mochify/driver-playwright",
"version": "0.1.2",
"description": "Playwright driver for Mochify",
"homepage": "https://github.com/mantoni/mochify.js",
"main": "index.js",
"scripts": {
"test": "echo \"No unit tests yet\"",
"test:integration": "echo \"No integration tests yet\"",
"preversion": "npm test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions driver-puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"name": "@mochify/driver-puppeteer",
"version": "0.2.2",
"description": "Puppeteer driver for Mochify",
"homepage": "https://github.com/mantoni/mochify.js",
"main": "index.js",
"scripts": {
"test": "echo \"No unit tests yet\"",
"test:integration": "echo \"No integration tests yet\"",
"preversion": "npm test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions driver-webdriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"name": "@mochify/driver-webdriver",
"version": "0.1.2",
"description": "WebDriver driver for Mochify",
"homepage": "https://github.com/mantoni/mochify.js",
"main": "index.js",
"scripts": {
"test": "echo \"No unit tests yet\"",
"test:integration": "echo \"No integration tests yet\"",
"preversion": "npm test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
5 changes: 2 additions & 3 deletions mochify/lib/mocha-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ const {
exports.createMochaRunner = createMochaRunner;

class MochaRunner extends EventEmitter {

constructor() {
super();
const stats = this.stats = {
const stats = (this.stats = {
suites: 0,
tests: 0,
passes: 0,
pending: 0,
failures: 0
};
});
this.on(EVENT_RUN_BEGIN, (json) => {
stats.start = json.start;
});
Expand Down
7 changes: 7 additions & 0 deletions mochify/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ ${modules.map((mod) => `<script type="module" src="${mod}"></script>`).join('')}
`);
return;
}
if (req.url === '/favicon.ico') {
res.writeHead(200, {
'Content-Type': mime.getType('favicon.ico')
});
res.end();
return;
}
const file = path.join(base_path, req.url.substring(1));
try {
await fs_promises.stat(file);
Expand Down
24 changes: 14 additions & 10 deletions mochify/lib/stack-mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ const { SourceMapConsumer } = require('source-map');

exports.stackMapper = stackMapper;

const stack_re = new RegExp('([a-z0-9]+\\.html|\\[stdin\\]|about:blank|'
+ 'http:\\/\\/[a-z0-9\\-_\\.]+(:[0-9]+)?\\/[^:]+|'
+ 'file:[^:]+|Unknown script code|<anonymous>|'
+ '__puppeteer_evaluation_script__)'
+ ':(\\d+)(:\\d+)?(\\D*)$', 'i');
const stack_re = new RegExp(
'([a-z0-9]+\\.html|\\[stdin\\]|about:blank|' +
'http:\\/\\/[a-z0-9\\-_\\.]+(:[0-9]+)?\\/[^:]+|' +
'file:[^:]+|Unknown script code|<anonymous>|' +
'__puppeteer_evaluation_script__)' +
':(\\d+)(:\\d+)?(\\D*)$',
'i'
);

function stackMapper(map) {
const consumer = new SourceMapConsumer(map);
return (stack) => stack
.split('\n')
.map((line) => mapLine(consumer, line))
.filter(Boolean)
.join('\n');
return (stack) =>
stack
.split('\n')
.map((line) => mapLine(consumer, line))
.filter(Boolean)
.join('\n');
}

function mapLine(consumer, line) {
Expand Down
2 changes: 2 additions & 0 deletions mochify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"name": "@mochify/mochify",
"version": "0.2.2",
"description": "Run mocha tests in headless browsers",
"homepage": "https://github.com/mantoni/mochify.js",
"main": "index.js",
"scripts": {
"test": "mocha '**/*.test.js'",
"test:integration": "mocha --timeout 10000 -R spec '**/*.integration.js'",
"watch": "npm test -- --watch",
"preversion": "npm test && npm run test:integration",
"version": "changes --commits --footer --workspace",
"postversion": "npm publish"
},
"keywords": [
Expand Down
35 changes: 22 additions & 13 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"lint": "eslint .",
"test": "npm test --workspaces",
"test:integration": "npm run test:integration --workspaces",
"prettier:check": "prettier --check *.{js,json,md}",
"prettier:write": "prettier --write *.{js,json,md}",
"prettier:check": "prettier --check '**/*.{js,json,md}'",
"prettier:write": "prettier --write '**/*.{js,json,md}'",
"prepare": "husky install && playwright install",
"preversion": "npm run lint && npm run prettier:check && npm test && npm run test:integration",
"version": "changes --commits --footer",
Expand All @@ -77,7 +77,7 @@
],
"devDependencies": {
"@sinonjs/referee-sinon": "^11.0.0",
"@studio/changes": "^2.2.0",
"@studio/changes": "^3.0.0",
"@studio/eslint-config": "^2.2.0",
"eslint": "^7.32.0",
"eslint-plugin-mocha": "^9.0.0",
Expand Down
Loading