Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Commit

Permalink
chore(infra): node 10+, webpack@5 compat, latest webpack-defaults (#84)
Browse files Browse the repository at this point in the history
* chore(infra): node 10+, latest webpack-defaults
- upgrade all deps to latest stable.
- regenerate `package-lock.json`.

* chore(tests): update to newer template
- add cjs test, checking pitch loader is set as well.
- update to latest test helpers, simplifing a bit with newer syntax.
- remove now-unused memory-fs (replaced with memfs; same as template).

* test: disable namedModules when snapshoting
to avoid env-specific information in bundle

* test: try using production mode
to see if webpack 4 and 5 bundles match then

* test: configure jest to run in node mode
it has jsdom failures in browser mode

* test: back to development mode
and turn moduleIds off, to try and normalize webpack 4/5

* test: behaviorial test using puppeteer

* test: ensure headless mode
used only for debugging

* test: longer timeout for browser tests

* feat: support webpack 5
- avoid using process.nextTick, as it is no longer polyfilled in webpack 5
- decrease test timeout to 15s (typo)
- decrease puppeteer timeout to 5s
- catch page errors after evaluation

* fix: revert start script to a regular function
that code is being bundled, so prefer older syntax

* fix: remove rest of MochaPhantomJS code

* chore(infra): regenerate package-lock
ensure we pass with latest 3rd, 4th, etc parties

* test: remove now unneeded lint globals

* test: increase puppeteer timeout to 15s
for slow CI.
set timeout of e2e test to 20s, so that proper errors will be shown.

* fix: ensure output works when injected to <head>
- avoid using document.write to be less destructive
- create output element right before running and after DOMContentLoaded
- remove initialization script in favor of resolving mocha's js/css once in loader
- use require.resolve so loader entry throws if not finding required files.
- ensure mocha.js and mocha.css don't get further processed by prefixing with !!. (no pre/post loaders as well; see: https://webpack.js.org/concepts/loaders/#inline)

* fix: mark webpack@5 as compatible peerDep

* chore(deps): remove now-unused "del" devDep
still brought indirectly by other deps

* chore(eps): update minimum mocha to 5+
per PR review
  • Loading branch information
AviVahl authored and evilebottnawi committed Dec 2, 2019
1 parent 48bede8 commit 5b44fa1
Show file tree
Hide file tree
Showing 23 changed files with 2,867 additions and 2,028 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = true
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ module. Thankfully, Github provides a means to do this. Add a dependency to the
```json
{
"devDependencies": {
"mocha-loader": "null/mocha-loader#{id}/head"
"mocha-loader": "webpack-contrib/mocha-loader#{id}/head"
}
}
```
Expand All @@ -149,7 +149,7 @@ Where `{id}` is the # ID of your Pull Request.

## Contributor License Agreement

When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/null/mocha-loader).
When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/webpack-contrib/mocha-loader).
If it is your first time, it will link you to the right place to sign it.
However, if you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution.

Expand Down
76 changes: 42 additions & 34 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ trigger:
- master
- next

variables:
npm_config_cache: $(Pipeline.Workspace)/.npm

jobs:
- job: Lint
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
Expand All @@ -20,10 +23,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm run lint
displayName: 'Run lint'
Expand All @@ -34,23 +39,22 @@ jobs:

- job: Linux
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
strategy:
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -65,10 +69,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand All @@ -86,23 +92,22 @@ jobs:

- job: macOS
pool:
vmImage: macOS-10.14
vmImage: macOS-latest
strategy:
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -117,10 +122,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand All @@ -138,23 +145,22 @@ jobs:

- job: Windows
pool:
vmImage: windows-2019
vmImage: windows-latest
strategy:
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- script: 'git config --global core.autocrlf input'
displayName: 'Config git core.autocrlf'
Expand All @@ -172,10 +178,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = (api) => {
'@babel/preset-env',
{
targets: {
node: '8.9.0',
node: '10.13.0',
},
},
],
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
testEnvironment: 'node',
};
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
'*.js': ['prettier --write', 'eslint --fix', 'git add'],
'*.{json,md,yml,css}': ['prettier --write', 'git add'],
'*.{json,md,yml,css,ts}': ['prettier --write', 'git add'],
};
Loading

0 comments on commit 5b44fa1

Please sign in to comment.