Closed kwonoj closed 6 years ago
Could you please share your wallaby config file?
Oops, sorry.
module.exports = (wallaby) => ({
files: [
'src/**/*.js?(x)',
'src/**/*.ts?(x)',
'src/**/*.html',
'spec/jest/**/*.snap',
{ pattern: 'spec/jest/**/!(*-spec)', instrument: false, load: true },
{ pattern: 'package.json', instrument: false, load: true }
],
tests: [
'spec/jest/**/*-spec.ts?(x)'
],
env: {
type: 'node',
runner: 'node',
//this'll allow test can determine runner environment
params: { env: 'wallaby=true' }
},
testFramework: 'jest',
compilers: {
'**/*.js?(x)': wallaby.compilers.typeScript(),
'**/*.ts?(x)': wallaby.compilers.typeScript()
},
workers: {
initial: 4,
regular: 2
},
reportConsoleErrorAsError: true,
lowCoverageThreshold: 50,
setup: function(w) {
jestConfig = {
resetMocks: true,
resetModules: true,
setupTestFrameworkScriptFile: './spec/jest/setup.js',
globals: { __JEST_DEV__: true }
};
w.testFramework.configure(jestConfig);
}
});
and just in case setup.js
is
// Initialize `chai-subset` to add partial object matcher to chai
const chai = require('chai');
chai.use(require('chai-subset'));
// Add a window.fetch mock
global.fetch = require('jest-fetch-mock');
// Electron's Node gets to use Chrome's V8,
// meaning that Electron's JavaScript features are usually a little
// bit ahead of what's available in Node.
//
// Todo: Remove when Node 8 becomes stable
require('../polyfills/pad-start');
Thanks! Could you please also share your tsconfig.json
file?
sure.
{
"compilerOptions": {
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": true,
"allowJs": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"noUnusedParameters": true,
"importHelpers": true,
"noEmitHelpers": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2016",
"jsx": "react",
"outDir": ".tmp/build",
"lib": [
"es2016",
"dom"
],
"typeRoots": [
"./node_modules/@types"
]
},
"include": [
"src/**/*",
"build/**/*",
"spec/**/*",
"danger/**/*",
"node_modules/electron-prebuilt-compile/node_modules/electron"
],
"formatCodeOptions": {
"indentSize": 2,
"tabSize": 2
}
}
Thanks! Could you please clone and try this simple repo https://github.com/wallabyjs/wallaby-jest-snapshots, try editing the src/component.spec.tsx
file to see if wallaby creates src/__tests__/__snapshots__/component.spec.ts.snap
next to the existing src/__tests__/__snapshots__/component.spec.tsx.snap
file?
with repo provided, it's not reproducible. in my repo, it even doesn't need to edit component (tsx
) file - as soon as I start wallaby, those files are generated. I haven't touch specific component / wallaby config / jest version all for a while, nothing's really changed.
And for fyi, just took diff between previous tsx.snap
snapshot to newly created ts.snap
, it is identical.
Hmm, it's interesting.
and recently wallaby started to create
team-add-button-spec.ts.snap
aside of those snapshots,
Could you please double check if the created file is team-add-button-spec.ts.snap
or team-add-button-spec.js.snap
(...ts.snap
vs ...js.snap
)?
Is this an OSS project? If yes, could you please share a link, if not, could you please share package.json
and package-lock
/yarn.lock
file?
I'm 100% sure it's
ts.snap
and tsx
component. Unfortunately, it is corp private repo so I can't share full package.json, let me try out redact few details.
package.json
{
"name": "boo-project",
"main": "./src/browser/es6-init.js",
"supportedOS": {
"darwin": ">= 10.9"
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
}
},
"dependencies": {
"@paulcbetts/system-idle-time": "1.0.4",
"@paulcbetts/v8-profiler": "5.6.6",
"JSONStream": "1.3.1",
"archiver": "1.3.0",
"circular-json": "0.3.3",
"classnames": "2.2.5",
"color": "0.11.4",
"connect": "3.6.0",
"debug": "2.6.3",
"electron-compile": "6.4.0",
"electron-fetch": "1.1.0",
"electron-redux": "1.3.0",
"electron-remote": "1.2.0",
"electron-spellchecker": "1.2.0",
"electron-windows-notifications": "1.1.16",
"electron-winstore-auto-launch": "1.1.1",
"error-stack-parser": "2.0.0",
"execa": "0.6.3",
"flux-standard-action": "1.2.0",
"form-data": "2.3.1",
"fs-extra": "4.0.1",
"getos": "3.0.0",
"hammerjs": "2.0.8",
"hashids": "1.1.1",
"hunspell-dict-downloader": "0.0.1",
"is-online": "7.0.0",
"jszip": "3.1.3",
"keyboard-layout": "2.0.13",
"lodash": "4.17.4",
"lru-cache": "4.0.2",
"message-format": "5.1.2",
"mime-types": "2.1.15",
"react": "15.4.2",
"react-addons-css-transition-group": "15.4.2",
"react-dom": "15.4.2",
"react-motion": "0.4.8",
"react-string-replace-recursively": "0.1.27",
"recompose": "0.23.1",
"redux": "3.6.0",
"redux-act": "1.2.0",
"redux-observable": "0.14.1",
"redux-persist": "github:CharlieHess/redux-persist#8c0956a165a9cae0fe160bba7cc6c7eb9b5a11d7",
"redux-persist-transform-encrypt": "1.0.2",
"redux-persist-transform-filter": "0.0.9",
"redux-persist-transform-passwords": "1.2.6",
"runas": "3.1.1",
"rxjs": "5.4.2",
"rxjs-requestidlecallback-scheduler": "0.0.3",
"rxjs-serial-subscription": "0.1.1",
"rxjs-spy": "3.1.4",
"semver": "5.3.0",
"signals": "1.0.0",
"spark-md5": "3.0.0",
"spawn-rx": "2.0.10",
"table": "4.0.1",
"temp": "0.8.3",
"tslib": "1.7.1",
"uuid": "3.0.1",
"windows-active-process": "1.0.0",
"windows-quiet-hours": "1.2.4",
"winston": "2.3.1",
"write-file-atomic": "1.3.1",
"write-file-atomic-fsync": "0.0.1",
"yargs": "7.0.2"
},
"private": true,
"scripts": {
"precommit": "lint-staged",
"prepush": "npm run build",
"postversion": "./script/postversion.sh && npm run docs",
"prepare-release": "ts-node ./script/prepare-release.js",
"patch:package": "patch-package",
"unversion": "./script/unversion.sh",
"prepare": "ts-node ./build/bootstrap-cli.js",
"package": "ts-node ./build/package-cli.js",
"shame": "tslint --type-check -c tslint.json -p tsconfig.json \"src/**/*.ts\" \"src/**/*.tsx\" \"spec/**/*.ts\" \"spec/**/*.tsx\" \"build/**/*.js\" \"build/**/*.ts\"",
"start": "cross-env DEBUG='logger\\:*,electron-spellchecker\\:*' electron . -r . --enable-logging --inspect",
"start:react-dev": "react-devtools",
"start:all": "npm-run-all --parallel start:react-dev start",
"mocha:electron": "electron-mocha --recursive --require=./spec/mocha/support.ts --reporter dot --bail",
"test:mock": "shx rm -rf ./.tmp/build/spec/jest/__mocks__ && jest --config jest.json --setupTestFrameworkScriptFile ./spec/jest/setup.js",
"test:electron:browser": "npm run mocha:electron -- \"./spec/mocha/browser/**/*.ts\"",
"test:electron:renderer": "npm run mocha:electron -- \"./spec/mocha/renderer/**/*.ts\"",
"test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" src",
"test": "npm-run-all test:**",
"coverage": "npm-run-all \"test:mock -- --coverage --no-cache --runInBand\"",
"build": "shx rm -rf ./.tmp && tsc",
"licenses": "ts-node ./build/generate-licenses-cli.js",
"copyright": "ts-node ./build/check-copyright-cli.js",
"dependencies": "depcruise --exclude \"^node_modules\" --output-type dot src | dot -T svg > dependencygraph.svg",
"node": "cross-env ELECTRON_RUN_AS_NODE=1 ./node_modules/electron-prebuilt-compile/node_modules/.bin/electron",
"publish": "ts-node ./build/cli/publish.ts",
"release": "ts-node ./build/cli/release.ts"
},
"devDependencies": {
"@felixrieseberg/nugget": "2.1.1",
"@kwonoj/rxjs-testscheduler-compat": "1.0.2",
"@mikermcneil/kit": "1.3.13",
"@paulcbetts/legal-eagle": "0.13.0-pr.11v5",
"@paulcbetts/linux-distro": "3.0.2",
"@types/archiver": "1.3.4",
"@types/bugsnag": "2.5.28",
"@types/chai": "3.5.2",
"@types/chai-subset": "1.3.0",
"@types/chalk": "0.4.31",
"@types/classnames": "0.0.32",
"@types/color": "0.12.1",
"@types/commander": "2.9.1",
"@types/connect": "3.4.30",
"@types/deep-freeze": "0.0.29",
"@types/form-data": "2.2.0",
"@types/fs-extra": "4.0.0",
"@types/hammerjs": "2.0.34",
"@types/jest": "20.0.8",
"@types/jsonstream": "0.8.28",
"@types/jszip": "0.0.32",
"@types/lodash": "4.14.64",
"@types/lru-cache": "4.0.0",
"@types/mime-types": "2.1.0",
"@types/node": "7.0.22",
"@types/pify": "0.0.28",
"@types/progress": "2.0.0",
"@types/react": "15.0.36",
"@types/react-addons-css-transition-group": "15.0.1",
"@types/react-dom": "0.14.23",
"@types/react-motion": "0.0.21",
"@types/react-test-renderer": "15.4.3",
"@types/recompose": "0.22.0",
"@types/semver": "5.3.31",
"@types/signals": "0.0.17",
"@types/sinon": "2.2.2",
"@types/spark-md5": "3.0.0",
"@types/table": "4.0.2",
"@types/temp": "0.8.29",
"@types/uuid": "2.0.29",
"@types/winston": "2.3.1",
"@types/yargs": "6.6.0",
"asar": "0.13.0",
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"chai-subset": "1.5.0",
"chalk": "2.0.1",
"commander": "2.9.0",
"conventional-commits-parser": "1.3.0",
"cross-env": "5.0.1",
"csslint": "1.0.5",
"danger": "1.1.0",
"date-fns": "1.28.4",
"deep-freeze": "0.0.1",
"dependency-cruiser": "2.3.2",
"devtron": "1.4.0",
"electron-compilers": "5.8.0",
"electron-mocha": "3.4.0",
"electron-osx-sign": "0.4.6",
"electron-packager": "8.7.2",
"electron-prebuilt-compile": "1.8.2-beta.1",
"electron-rebuild": "~1.5.7",
"electron-windows-store": "0.10.2",
"electron-winstaller": "2.5.1",
"esdoc": "0.5.2",
"esdoc-es7-plugin": "0.0.3",
"extract-zip": "1.6.0",
"github": "9.2.0",
"glob": "7.1.2",
"jade": "1.11.0",
"jest": "21.1.0",
"jest-fetch-mock": "1.2.1",
"jest-junit-reporter": "1.1.0",
"json-stable-stringify": "1.0.1",
"lcov-summary": "1.0.1",
"lint-staged": "3.6.1",
"node-fetch": "1.7.1",
"npm-config-arguments": "1.1.3",
"npm-run-all": "4.0.2",
"patch-package": "3.4.0",
"performance-now": "2.1.0",
"progress": "2.0.0",
"react-devtools": "2.1.5",
"react-test-renderer": "15.4.2",
"s3": "4.4.0",
"shelljs": "0.7.8",
"shx": "0.2.2",
"sinon": "2.3.7",
"sinon-chai": "2.11.0",
"split-lines": "1.1.0",
"term-img": "1.0.0",
"ts-jest": "21.0.1",
"ts-node": "3.2.0",
"tslint": "5.4.3",
"tslint-eslint-rules": "4.1.1",
"tslint-microsoft-contrib": "5.0.0",
"tslint-no-unused-expression-chai": "0.0.2",
"tslint-react": "3.0.0",
"tsutils": "1.6.0",
"typedoc": "0.5.10",
"typedoc-plugin-external-module-name": "1.0.9",
"typedoc-plugin-internal-external": "1.0.9",
"typedoc-plugin-ui-router": "1.0.6",
"typescript": "2.5.2"
},
"engines": {
"node": ">=7.1.0",
"npm": ">=5.4.0"
}
}
Thanks for the provided details! The issue is fixed and the fix is published in the latest core v1.0.509.
Issue description or question
I have jest snapshot generated for
tsx
component, i.eteam-add-button-spex.tsx.snap
by runningjest --updatesnatshot
, and recently wallaby started to createteam-add-button-spec.ts.snap
aside of those snapshots, while component hasn't changed / extension is stilltsx
. Is there any changes requires configuration to match snapshot extension?I could see wallaby added those files while running.
Wallaby.js configuration file
Code editor or IDE name and version
Visual Studio Code v1.? WebStorm v? IntelliJ IDEA v? Atom v1.? Visual Studio v? Sublime Text v3 build ?
OS name and version
Windows OSX Linux