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

Fix broken tests #804

Merged
merged 8 commits into from
May 28, 2019
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
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.7.0",
"husky": "^1.3.1",
"lerna": "^3.13.2",
"lint-staged": "^8.1.5",
"prettier": "^1.16.4"
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.13.0",
"husky": "^2.3.0",
"lerna": "^3.14.1",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1"
},
"husky": {
"hooks": {
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/lib/lib/webpack/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ module.exports = function(env, params) {
);
return '';
}
const { cwd } = env;

let preact = require('preact'),
renderToString = require('preact-render-to-string');
const preact = require(require.resolve(`${cwd}/node_modules/preact`));
const renderToString = require(require.resolve(
`${cwd}/node_modules/preact-render-to-string`
));

return renderToString(preact.h(app, { ...params, url }));
} catch (err) {
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/lib/lib/webpack/webpack-server-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ function serverConfig(env) {
chunkFilename: '[name].chunk.[chunkhash:5].js',
libraryTarget: 'commonjs2',
},
externals: {
preact: 'preact',
},
target: 'node',
resolveLoader: {
alias: {
Expand Down
54 changes: 26 additions & 28 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"preact": "lib/index.js"
},
"scripts": {
"pretest": "rimraf tests/output",
"test": "jest",
"posttest": "rimraf tests/output"
"test": "jest"
},
"jest": {
"setupFilesAfterEnv": [
Expand Down Expand Up @@ -47,54 +45,54 @@
"devDependencies": {
"eslint": "^5.16.0",
"html-looks-like": "^1.0.2",
"jest": "^24.7.1",
"lerna": "^3.13.2",
"lint-staged": "^8.1.5",
"jest": "^24.8.0",
"lerna": "^3.14.1",
"lint-staged": "^8.1.7",
"mkdirp": "^0.5.1",
"ncp": "^2.0.0",
"node-sass": "^4.9.0",
"node-sass": "^4.12.0",
"p-retry": "^4.1.0",
"preact": "^8.1.0",
"preact-compat": "^3.14.3",
"preact-compat": "^3.18.5",
"preact-render-to-string": "^4.1.0",
"preact-router": "^2.6.1",
"puppeteer": "^1.14.0",
"puppeteer": "^1.17.0",
"sass-loader": "^7.0.1"
},
"peerDependencies": {
"preact": "*",
"preact-render-to-string": "*"
},
"dependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/plugin-transform-react-jsx": "^7.3.0",
"@babel/preset-env": "^7.4.3",
"@babel/preset-env": "^7.4.5",
"@babel/preset-typescript": "^7.3.3",
"@preact/async-loader": "^3.0.0-rc.0",
"autoprefixer": "^9.5.1",
"babel-esm-plugin": "^0.4.1",
"babel-loader": "^8.0.5",
"babel-loader": "^8.0.6",
"babel-plugin-macros": "^2.5.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"brotli-webpack-plugin": "^1.0.0",
"console-clear": "^1.0.0",
"copy-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^5.0.3",
"critters-webpack-plugin": "^1.3.3",
"cross-spawn-promise": "^0.10.1",
"css-loader": "^2.1.1",
"ejs-loader": "^0.3.3",
"esm": "^3.2.22",
"esm": "^3.2.25",
"fast-async": "^6.3.7",
"file-loader": "^3.0.1",
"fork-ts-checker-webpack-plugin": "^1.0.1",
"fork-ts-checker-webpack-plugin": "^1.3.4",
"get-port": "^5.0.0",
"gittar": "^0.1.0",
"glob": "^7.1.3",
"glob": "^7.1.4",
"html-webpack-exclude-assets-plugin": "0.0.7",
"html-webpack-plugin": "^3.2.0",
"ip": "^1.1.5",
Expand All @@ -108,9 +106,9 @@
"postcss-loader": "^3.0.0",
"progress-bar-webpack-plugin": "^1.12.1",
"promise-polyfill": "^8.1.0",
"prompts": "^2.0.4",
"prompts": "^2.1.0",
"raw-loader": "^1.0.0",
"react-hot-loader": "^4.8.3",
"react-hot-loader": "^4.8.8",
"require-relative": "^0.8.7",
"rimraf": "^2.6.1",
"sade": "^1.4.1",
Expand All @@ -119,18 +117,18 @@
"stack-trace": "0.0.10",
"style-loader": "^0.23.1",
"sw-precache-webpack-plugin": "^0.11.2",
"terser-webpack-plugin": "^1.2.3",
"typescript": "^3.4.3",
"update-notifier": "^2.5.0",
"terser-webpack-plugin": "^1.3.0",
"typescript": "^3.4.5",
"update-notifier": "^3.0.0",
"url-loader": "^1.0.1",
"validate-npm-package-name": "^3.0.0",
"webpack": "^4.29.6",
"webpack": "^4.32.2",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-dev-server": "^3.3.1",
"webpack-fix-style-only-entries": "^0.2.1",
"webpack-dev-server": "^3.4.1",
"webpack-fix-style-only-entries": "^0.2.2",
"webpack-merge": "^4.1.0",
"webpack-plugin-replace": "^1.2.0",
"which": "^1.2.14",
"workbox-webpack-plugin": "^4.2.0"
"workbox-webpack-plugin": "^4.3.1"
}
}
10 changes: 9 additions & 1 deletion packages/cli/tests/lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const { join } = require('path');
const { existsSync, unlinkSync } = require('fs');
const { existsSync, unlinkSync, symlinkSync } = require('fs');
const cmd = require('../../lib/commands');
const { tmpDir } = require('./output');
const mkdirp = require('mkdirp');

const root = join(__dirname, '../../../..');

function linkPackage(name, from, to) {
symlinkSync(join(from, 'node_modules', name), join(to, 'node_modules', name));
}

const argv = {
_: [],
src: 'src',
Expand All @@ -30,6 +36,8 @@ exports.create = async function(template, name) {

exports.build = function(cwd, options) {
mkdirp.sync(join(cwd, 'node_modules')); // ensure exists, avoid exit()
linkPackage('preact', root, cwd);
linkPackage('preact-render-to-string', root, cwd);
let opts = Object.assign({ cwd }, argv);
return cmd.build(argv.src, Object.assign({}, opts, options));
};
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/tests/setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const { join } = require('path');
const rimraf = require('rimraf');

rimraf.sync(join(__dirname, 'output'));

jasmine.DEFAULT_TIMEOUT_INTERVAL = 240 * 1000;

if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) {
Expand Down
Loading