Browse Source

Use mocha-loader

master
Futago-za Ryuu 2 years ago
parent
commit
6525825f2e
  1. 2
      docs/.vuepress/public/benchmark-bundle.min.js
  2. 186
      docs/.vuepress/public/test-bundle.min.js
  3. 12
      test/browser.js
  4. 1
      test/package.json
  5. 1
      tools/bundler/package.json
  6. 15
      tools/bundler/target.js
  7. 2
      webpack.config.js
  8. 50
      yarn.lock

2
docs/.vuepress/public/benchmark-bundle.min.js
File diff suppressed because it is too large
View File

186
docs/.vuepress/public/test-bundle.min.js
File diff suppressed because it is too large
View File

12
test/browser.js

@ -0,0 +1,12 @@
"use strict";
/*
This file is loaded through Webpack to automatically get mocha test files,
and create a valid bundled file that executes on the browser.
*/
const context = require.context( "mocha-loader!./", true, /.+\.(spec|test)\.js?$/ );
context.keys().forEach( context );
module.exports = context;

1
test/package.json

@ -5,6 +5,7 @@
"dependencies": {
"chai": "4.2.0",
"chai-like": "1.1.1",
"mocha-loader": "2.0.0",
"sinon": "7.2.3"
}
}

1
tools/bundler/package.json

@ -11,7 +11,6 @@
"@futagoza/child-process": "1.0.0",
"babel-loader": "8.0.5",
"dedent": "0.7.0",
"glob": "7.1.3",
"webpack": "4.29.3",
"webpack-cli": "3.2.3"
},

15
tools/bundler/target.js

@ -1,7 +1,6 @@
"use strict";
const dedent = require( "dedent" );
const glob = require( "glob" );
const path = require( "path" );
const peg = require( "pegjs" );
const webpack = require( "webpack" );
@ -31,20 +30,6 @@ function target( { entry, library, output } ) {
const cwd = process.cwd();
if ( typeof entry === "object" ) Object
.keys( entry )
.forEach( name => {
const value = entry[ name ];
entry[ name ] = value.includes( "*" )
? glob
.sync( value )
.map( p => path.join( cwd, p ) )
: value;
} );
return {
mode: process.argv.includes( "--mode=development" ) ? "development" : "production",

2
webpack.config.js

@ -27,7 +27,7 @@ module.exports = [
entry: {
"benchmark": require.resolve( "@pegjs/benchmark-suite/browser.js" ),
"test": "test/**/*.+(spec|test).js",
"test": require.resolve( "@pegjs/spec-suite/browser.js" ),
},
library: [ "peg", "[name]" ],
output: "docs/.vuepress/public/[name]-bundle.min.js",

50
yarn.lock

@ -2369,6 +2369,24 @@ css-loader@^0.28.11:
postcss-value-parser "^3.3.0"
source-list-map "^2.0.0"
css-loader@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-1.0.1.tgz#6885bb5233b35ec47b006057da01cc640b6b79fe"
integrity sha512-+ZHAZm/yqvJ2kDtPne3uX0C+Vr3Zn5jFn2N4HywtS5ujwvsVkyg0VArEXpl3BgczDA8anieki1FIzhchX4yrDw==
dependencies:
babel-code-frame "^6.26.0"
css-selector-tokenizer "^0.7.0"
icss-utils "^2.1.0"
loader-utils "^1.0.2"
lodash "^4.17.11"
postcss "^6.0.23"
postcss-modules-extract-imports "^1.2.0"
postcss-modules-local-by-default "^1.2.0"
postcss-modules-scope "^1.1.0"
postcss-modules-values "^1.3.0"
postcss-value-parser "^3.3.0"
source-list-map "^2.0.0"
css-parse@1.7.x:
version "1.7.0"
resolved "https://registry.yarnpkg.com/css-parse/-/css-parse-1.7.0.tgz#321f6cf73782a6ff751111390fc05e2c657d8c9b"
@ -5168,6 +5186,16 @@ mocha-junit-reporter@1.18.0:
strip-ansi "^4.0.0"
xml "^1.0.0"
mocha-loader@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/mocha-loader/-/mocha-loader-2.0.0.tgz#7d32723b0e27ba583fee0031601fea6bd6cd16a5"
integrity sha512-WYFbhZGCCBmQOavgKo49aAdv4C7QEll+/WU/KhiIQNaegG4JSP362BGvXQkk9J+jd/8bV2PxgmD7LbFOXigtoA==
dependencies:
css-loader "^1.0.0"
loader-utils "^1.1.0"
script-loader "^0.7.2"
style-loader "^0.22.1"
mocha-multi-reporters@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/mocha-multi-reporters/-/mocha-multi-reporters-1.1.7.tgz#cc7f3f4d32f478520941d852abb64d9988587d82"
@ -6212,7 +6240,7 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0
source-map "^0.5.6"
supports-color "^3.2.3"
postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.17:
postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.17, postcss@^6.0.23:
version "6.0.23"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324"
integrity sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==
@ -6433,6 +6461,11 @@ raw-body@2.3.3:
iconv-lite "0.4.23"
unpipe "1.0.0"
raw-loader@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
integrity sha1-DD0L6u2KAclm2Xh793goElKpeao=
rc@^1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
@ -6829,6 +6862,13 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"
script-loader@^0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/script-loader/-/script-loader-0.7.2.tgz#2016db6f86f25f5cf56da38915d83378bb166ba7"
integrity sha512-UMNLEvgOAQuzK8ji8qIscM3GIrRCWN6MmMXGD4SD5l6cSycgGsCo0tX5xRnfQcoghqct0tjHjcykgI1PyBE2aA==
dependencies:
raw-loader "~0.5.1"
section-matter@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/section-matter/-/section-matter-1.0.0.tgz#e9041953506780ec01d59f292a19c7b850b84167"
@ -7363,6 +7403,14 @@ strip-json-comments@^2.0.1, strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
style-loader@^0.22.1:
version "0.22.1"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.22.1.tgz#901ea28aac78fcc00c5075585ac07d7ef3f87a52"
integrity sha512-WXUrLeinPIR1Oat3PfCDro7qTniwNTJqGqv1KcQiL3JR5PzrVLTyNsd9wTsPXG/qNCJ7lzR2NY/QDjFsP7nuSQ==
dependencies:
loader-utils "^1.1.0"
schema-utils "^0.4.5"
stylus-loader@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/stylus-loader/-/stylus-loader-3.0.2.tgz#27a706420b05a38e038e7cacb153578d450513c6"

Loading…
Cancel
Save