Open tremorth opened 5 years ago
Thanks for your detailed bug description. However, the error is just NPM complaining that something is wrong. Can you post the full log?
Yeah sure. Here's the full log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test:t',
1 verbose cli 'foobar' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'pretest:t', 'test:t', 'posttest:t' ]
5 info lifecycle severa_snapshot_testing@1.0.0~pretest:t: severa_snapshot_testing@1.0.0
6 info lifecycle severa_snapshot_testing@1.0.0~test:t: severa_snapshot_testing@1.0.0
7 verbose lifecycle severa_snapshot_testing@1.0.0~test:t: unsafe-perm in lifecycle true
8 verbose lifecycle severa_snapshot_testing@1.0.0~test:t: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\git\gui-testing\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Git\cmd;C:\Users\joonas.heinonen.INTERNAL\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\WebStorm 2019.1.1\bin;C:\Users\joonas.heinonen.INTERNAL\AppData\Roaming\npm;C:\Users\joonas.heinonen.INTERNAL\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle severa_snapshot_testing@1.0.0~test:t: CWD: C:\git\gui-testing
10 silly lifecycle severa_snapshot_testing@1.0.0~test:t: Args: [ '/d /s /c', 'jest -t --runInBand "foobar"' ]
11 silly lifecycle severa_snapshot_testing@1.0.0~test:t: Returned: code: 3221225477 signal: null
12 info lifecycle severa_snapshot_testing@1.0.0~test:t: Failed to exec test:t script
13 verbose stack Error: severa_snapshot_testing@1.0.0 test:t: jest -t --runInBand "foobar"
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid severa_snapshot_testing@1.0.0
15 verbose cwd C:\git\gui-testing
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:t" "foobar"
18 verbose node v10.15.3
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 3221225477
22 error severa_snapshot_testing@1.0.0 test:t: jest -t --runInBand "foobar"
22 error Exit status 3221225477
23 error Failed at the severa_snapshot_testing@1.0.0 test:t script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
Any clue what's going on?
Are the tests running without invocation of jest-screenshot? I can't figure out the error form this. It looks obscure.
setup-framework.js
const jestScreenshot = require('jest-screenshot');
jestScreenshot.setupJestScreenshot();
jest.setup.js
jest.setTimeout(30000);
jest.config.js
module.exports = {
setupFilesAfterEnv: ['<rootDir>/setup-framework.js', '<rootDir>/jest.setup.js'],
globalSetup: './global-setup.js',
globalTeardown: './global-teardown.js',
preset: 'jest-puppeteer',
reporters: [
'default',
'jest-screenshot/reporter'
]
};
global-setup.js
const {setup: setupPuppeteer} = require('jest-environment-puppeteer');
const puppeteer = require('puppeteer');
const puppeteerMockDate = require('./puppeteer-datemock')
// Connect to the browser created in jest-environment-puppeteer
// so we can perform browser actions once before all tests are run.
module.exports = async function globalSetup(globalConfig) {
await setupPuppeteer(globalConfig);
// connect to puppeteer
const browser = await puppeteer.connect({
browserWSEndpoint: process.env.PUPPETEER_WS_ENDPOINT, defaultViewport: null
});
// set Constant time to 17.04.2019
try {
puppeteerMockDate.mockDate(browser);
} catch (e) {
console.log(e)
}
};
global-teardown.js
// global-teardown.js
const { teardown: teardownPuppeteer } = require('jest-environment-puppeteer');
module.exports = async function globalTeardown(globalConfig) {
await teardownPuppeteer(globalConfig);
};
Any update on this?
Did you manage or try to reproduce the error?
No, sorry, I am rather busy at the moment.
What happpens?
Running
expect(newImage).toMatchImageSnapshot()
crashes,Here's the error log;
> jest -t --runInBand "foobar"
RUNS tests/foobar.test.js
npm ERR! code ELIFECYCLE npm ERR! errno 3221225477 npm ERR! foobar_testing@1.0.0 test:t: jest -t --runInBand "foobar" npm ERR! Exit status 3221225477 npm ERR! npm ERR! Failed at the foobar_testing@1.0.0 test:t script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This is the baseimage:
This is the new image:
Here's a repro with the above images;
const fs = require('fs');
describe("Foo", () => {
const newImage = fs.readFileSync(__dirname + "/__snapshots__/newimage.png");
const oldImage = fs.readFileSync(__dirname + "/__snapshots__/oldimage.png");
it("bar", () => { expect(oldImage).toMatchImageSnapshot(); }); });
What is expected?
The image comparison should catch the differences normally and generate the report.