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
Update Mocha to v8, drop Phantomic, run browser tests in Chromium #35
Changes from all commits
5588e29
c321c00
df8ffea
9b4e1b2
3bd112a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
- "8" | ||
- "10" | ||
- "12" | ||
- "14" | ||
- "16" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,11 @@ module.exports = function (b, opts) { | |
return { main : pkg.browser }; | ||
} | ||
}); | ||
var broutPath = path.relative(process.cwd(), broutFile); | ||
b.require('./' + broutPath.replace(/\\/g, '/'), { | ||
expose : 'brout' | ||
}); | ||
|
||
var mochaReporters = require(opts.mochaPath | ||
? path.resolve(process.cwd(), opts.mochaPath, 'lib', 'mocha') | ||
: 'mocha').reporters; | ||
|
@@ -56,10 +61,6 @@ module.exports = function (b, opts) { | |
expose: reporter | ||
}); | ||
} | ||
var broutPath = path.relative(process.cwd(), broutFile); | ||
b.require('./' + broutPath.replace(/\\/g, '/'), { | ||
expose : 'brout' | ||
}); | ||
|
||
var mochaPath = opts.mochaPath | ||
? resolve.sync('mocha.js', { paths: [opts.mochaPath] }) | ||
|
@@ -78,8 +79,8 @@ module.exports = function (b, opts) { | |
|| 80; | ||
var setupContent = content | ||
.replace('{{WINDOW_WIDTH}}', JSON.stringify(windowWidth)) | ||
.replace('{{REPORTER}}', reporter) | ||
.replace('\'{{REPORTER_OPTIONS}}\'', JSON.stringify(reporterOptions)) | ||
.replace(/{{REPORTER}}/g, reporter) | ||
.replace(/'{{REPORTER_OPTIONS}}'/g, JSON.stringify(reporterOptions)) | ||
.replace('{{YIELDS}}', yields) | ||
.replace('{{UI}}', ui) | ||
.replace('\'{{TIMEOUT}}\'', timeout) | ||
|
@@ -94,7 +95,6 @@ module.exports = function (b, opts) { | |
b.transform(function () { | ||
var s = ''; | ||
return through(function (chunk, enc, next) { | ||
/*jslint unparam: true*/ | ||
s += chunk; | ||
var p = s.lastIndexOf('\n'); | ||
if (p !== -1) { | ||
|
@@ -129,7 +129,6 @@ module.exports = function (b, opts) { | |
|
||
function apply() { | ||
b.pipeline.get('deps').push(through.obj(function (row, enc, next) { | ||
/*jslint unparam: true*/ | ||
if (row.entry) { | ||
row.deps['mocaccino-setup'] = setupFile; | ||
row.order++; | ||
|
@@ -139,7 +138,9 @@ module.exports = function (b, opts) { | |
var self = this; | ||
listener.then(function (err, res) { | ||
if (!err) { | ||
setupSource = (res.mocha || '') + res.setup; | ||
setupSource = (opts.node ? '' : 'require(\'brout\');\n') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mocha 6.2.0 starts adding behavior to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My opinion is that any hack that get's us there is fine 😆 |
||
+ (res.mocha || '') | ||
+ res.setup; | ||
self.push(createSetupEntry()); | ||
} | ||
next(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ | |
*/ | ||
'use strict'; | ||
|
||
require('brout'); | ||
|
||
Mocha.reporters.Base.window.width = JSON.parse('{{WINDOW_WIDTH}}'); | ||
Mocha.reporters.Base.symbols.dot = '.'; | ||
var grep = '{{GREP}}'; | ||
|
@@ -21,10 +19,16 @@ var mocha = new Mocha({ | |
if ('{{INVERT}}' === true) { // eslint-disable-line no-constant-condition | ||
mocha.invert(); | ||
} | ||
mocha.reporter('{{REPORTER}}', '{{REPORTER_OPTIONS}}'); | ||
|
||
if (Mocha.reporters['{{REPORTER}}']) { | ||
mocha.reporter('{{REPORTER}}', '{{REPORTER_OPTIONS}}'); | ||
} else { | ||
mocha.reporter(require('{{REPORTER}}'), '{{REPORTER_OPTIONS}}'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mocha is now bundled using Rollup which does not support dynamic requires for CommonJS. This way we pass in the reporter module instead of its name so that Mocha doesn't have to do any module resolution anymore. |
||
} | ||
|
||
mocha.ui('{{UI}}'); | ||
mocha.timeout('{{TIMEOUT}}'); | ||
mocha.useColors('{{USE_COLORS}}'); | ||
mocha.color('{{USE_COLORS}}'); | ||
mocha.suite.emit('pre-require', window, '', mocha); | ||
var t = new Date().getTime(); | ||
var y = Number('{{YIELDS}}'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ if ('{{INVERT}}' === true) { // eslint-disable-line no-constant-condition | |
} | ||
_mocha.reporter('{{REPORTER}}', '{{REPORTER_OPTIONS}}'); | ||
_mocha.timeout('{{TIMEOUT}}'); | ||
_mocha.useColors('{{USE_COLORS}}'); | ||
_mocha.color('{{USE_COLORS}}'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
_mocha.suite.emit('pre-require', global, '', _mocha); | ||
|
||
setTimeout(function () { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not strictly necessary, but it's a leftover from moving things around and I felt the order is now easier to understand. It could also just be reverted again.