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

Commit

Permalink
Migrating tests to Jest part 1 #397
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-martic-sociomantic committed Jun 18, 2018
1 parent 8982d2f commit 69aed60
Show file tree
Hide file tree
Showing 66 changed files with 3,434 additions and 2,593 deletions.
8 changes: 6 additions & 2 deletions cfg/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ const localIdentName = process.env.REACT_WEBPACK_ENV === 'dev' ?

module.exports = {
output : { path: path.join( __dirname, '../dist' ) },
resolve : {
resolve : {
extensions : [ '.js', '.json', '.jsx' ],
modules : [ path.join( __dirname, '../node_modules' ) ],
},
module : {
alias : {
config$ : './configs/app-config.js',
react : './node_modules/react',
},
module : {
rules : [
{
test : /\.jsx?$/,
Expand Down
8 changes: 8 additions & 0 deletions fileTransformer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require( 'path' );

module.exports = {
process( src, filename, config, options )
{
return `module.exports = ${JSON.stringify( path.basename( filename ) )};`;
},
};
316 changes: 173 additions & 143 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,145 +1,175 @@
{
"name": "nessie-ui",
"version": "5.14.0",
"description": "Nessie React Components",
"author": "Sociomantic Labs GmbH",
"contributors": [
"Conor Cafferkey (https://github.com/conor-cafferkey-sociomantic)",
"daniel-martic-sociomantic (https://github.com/daniel-martic-sociomantic)",
"Eric (https://github.com/eric-martinez-sociomantic)",
"Damian Rodriguez (https://github.com/damian-rodriguez-sociomantic)",
"Mihail Alexe (https://github.com/mihail-alexe-sociomantic)",
"Andrei Placinta (https://github.com/andrei-placinta-sociomantic)",
"Joppe Rhebergen (https://github.com/joppe-rhebergen-sociomantic)",
"Eric Martinez Solis (https://github.com/ericgraficode)",
"Josh Wilson <josh.wilson@sociomantic.com> (https://github.com/josh-wilson-sociomantic)",
"Mahmoud Zakria (https://github.com/mahmoud-zakria-sociomantic)"
],
"main": "dist",
"scripts": {
"build": "yarn updateStyles && yarn updateSprite",
"bump:major": "yarn pre-bump ; release-it major --config=preReleaseit.json -n && yarn changelog && release-it major --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"bump:minor": "yarn pre-bump ; release-it minor --config=preReleaseit.json -n && yarn changelog && release-it minor --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"bump": "yarn pre-bump ; release-it --config=preReleaseit.json -n && yarn changelog && release-it --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"changelog": "yarn auto-changelog -- --commit-limit false --output CHANGELOG.md && git tag --delete $(git describe --tags --abbrev=0) && git add . && git commit --amend --no-edit",
"dev": "webpack --env=dev --watch",
"dist-watch": "webpack --env=dist --watch",
"dist": "webpack --env=dist",
"lint-fix": "npm run lint -- --fix",
"lint": "eslint --cache --format=node_modules/eslint-formatter-pretty .",
"loch:build": "loch:build -e dev -c ./ -j src/defaults.json",
"loch:clean": "rimraf .lochness",
"npm-publish": "npm publish --registry=https://registry.npmjs.org/",
"post-bump": "git checkout master && git cherry-pick --strategy=recursive -X theirs Release && git push --no-verify",
"pre-bump": "git checkout Release && git pull && git merge master -X theirs --no-ff --no-edit && yarn build && git add . && git commit -m 'compiled styles and sprite'",
"serve": "loch -e dev -c ./ -j src/defaults.json",
"start": "yarn loch:build && concurrently --kill-others \"yarn dev\" \"yarn serve\"",
"svgSprite": "./.prep-icon.sh && ./.generate-sprite.sh",
"tdd": "karma start --autoWatch=true --reporters=mocha,notification --singleRun=false",
"test:Chrome": "karma start --singleRun=false --browsers Chrome",
"test:v:build": "yarn loch:build",
"test:v:buildFresh": "concurrently \"yarn build\" \"yarn test:v:build\"",
"test:v:clean": "yarn loch:clean",
"test:v:ref": "visualTest -e dev -c ./ -j src/defaults.json -t reference",
"test:v": "visualTest -e dev -c ./ -j src/defaults.json",
"test:visuals": "yarn test:v:clean && yarn build && yarn test:v:build && yarn test:v",
"test": "karma start --reporters=mocha",
"updateSprite": "yarn svgSprite && cp src/Icon/sprite.html dist/sprite.html && echo 'updated dist sprite'",
"updateStyles": "yarn dist && cp dist/styles.css dist/styles.scss && echo 'updated nessie dist styles'"
},
"keywords": [
"scotland",
"nessie",
"react",
"css",
"javascript"
],
"repository": {
"type": "git",
"url": "git+https://github.com/sociomantic-tsunami/nessie.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/sociomantic-tsunami/nessie/issues"
},
"homepage": "https://github.com/sociomantic-tsunami/nessie#readme",
"devDependencies": {
"auto-changelog": "^1.4.5",
"autoprefixer": "^8.5.2",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^4.1.2",
"codemirror": "^5.35.0",
"concurrently": "^3.5.1",
"css-loader": "^0.28.11",
"enzyme": "^2.9.1",
"eslint": "^4.6.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-arca": "^0.6.0",
"eslint-plugin-compat": "^2.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.3.0",
"file-loader": "^1.1.11",
"flounder": "^1.3.5",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon-chai": "^1.3.4",
"karma-webpack": "^3.0.0",
"loch-ness": "^2.2.2",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.1",
"microbejs": "^0.5.2",
"mini-css-extract-plugin": "^0.4.0",
"mocha": "^5.2.0",
"normalize.css": "^8.0.0",
"null-loader": "^0.1.1",
"postcss": "^6.0.22",
"postcss-advanced-variables": "^2.3.3",
"postcss-attribute-case-insensitive": "^3.0.0",
"postcss-calc": "^6.0.1",
"postcss-color-function": "^4.0.1",
"postcss-custom-media": "^6.0.0",
"postcss-custom-properties": "^7.0.0",
"postcss-custom-selectors": "^4.0.1",
"postcss-extend": "^1.0.5",
"postcss-font-variant": "^3.0.0",
"postcss-initial": "^2.0.0",
"postcss-loader": "^2.1.5",
"postcss-media-minmax": "^3.0.0",
"postcss-nested": "^3.0.0",
"postcss-partial-import": "^4.1.0",
"postcss-pseudo-class-any-link": "^5.0.0",
"postcss-replace-overflow-wrap": "^2.0.0",
"postcss-selector-matches": "^3.0.1",
"postcss-selector-not": "^3.0.1",
"prop-types": "^15.5.8",
"raw-loader": "^0.5.1",
"react": "^15.6.2",
"react-addons-css-transition-group": "^15.6.2",
"react-dom": "^15.6.2",
"react-test-renderer": "^15.6.2",
"release-it": "^7.4.5",
"replace": "^1.0.0",
"rimraf": "^2.6.2",
"sinon": "^5.0.10",
"sinon-chai": "^3.1.0",
"svg-loader": "^0.0.2",
"svg-sprite-generator": "^0.0.7",
"svgo": "^0.7.2",
"url-loader": "^1.0.1",
"webpack": "^4.10.2",
"webpack-cli": "^2.1.4"
},
"dependencies": {}
"name": "nessie-ui",
"version": "5.14.0",
"description": "Nessie React Components",
"author": "Sociomantic Labs GmbH",
"contributors": [
"Conor Cafferkey (https://github.com/conor-cafferkey-sociomantic)",
"daniel-martic-sociomantic (https://github.com/daniel-martic-sociomantic)",
"Eric (https://github.com/eric-martinez-sociomantic)",
"Damian Rodriguez (https://github.com/damian-rodriguez-sociomantic)",
"Mihail Alexe (https://github.com/mihail-alexe-sociomantic)",
"Andrei Placinta (https://github.com/andrei-placinta-sociomantic)",
"Joppe Rhebergen (https://github.com/joppe-rhebergen-sociomantic)",
"Eric Martinez Solis (https://github.com/ericgraficode)",
"Josh Wilson <josh.wilson@sociomantic.com> (https://github.com/josh-wilson-sociomantic)",
"Mahmoud Zakria (https://github.com/mahmoud-zakria-sociomantic)"
],
"main": "dist",
"jest": {
"modulePaths": [
"/shared/vendor/modules"
],
"moduleFileExtensions": [
"js",
"jsx"
],
"moduleDirectories": [
"node_modules",
"bower_components",
"shared"
],
"moduleNameMapper": {
"^react(.*)$": "<rootDir>/node_modules/react",
"^config$": "<rootDir>/configs/app-config.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
},
"transformIgnorePatterns": [
"node_modules/(?!(react-native|my-project|react-native-button)/)"
]
},
"scripts": {
"build": "yarn updateStyles && yarn updateSprite",
"bump:major": "yarn pre-bump ; release-it major --config=preReleaseit.json -n && yarn changelog && release-it major --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"bump:minor": "yarn pre-bump ; release-it minor --config=preReleaseit.json -n && yarn changelog && release-it minor --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"bump": "yarn pre-bump ; release-it --config=preReleaseit.json -n && yarn changelog && release-it --config=postReleaseit.json -n && yarn npm-publish && yarn post-bump",
"changelog": "yarn auto-changelog -- --commit-limit false --output CHANGELOG.md && git tag --delete $(git describe --tags --abbrev=0) && git add . && git commit --amend --no-edit",
"dev": "webpack --env=dev --watch",
"dist-watch": "webpack --env=dist --watch",
"dist": "webpack --env=dist",
"lint-fix": "npm run lint -- --fix",
"lint": "eslint --cache --format=node_modules/eslint-formatter-pretty .",
"loch:build": "loch:build -e dev -c ./ -j src/defaults.json",
"loch:clean": "rimraf .lochness",
"npm-publish": "npm publish --registry=https://registry.npmjs.org/",
"post-bump": "git checkout master && git cherry-pick --strategy=recursive -X theirs Release && git push --no-verify",
"pre-bump": "git checkout Release && git pull && git merge master -X theirs --no-ff --no-edit && yarn build && git add . && git commit -m 'compiled styles and sprite'",
"serve": "loch -e dev -c ./ -j src/defaults.json",
"start": "yarn loch:build && concurrently --kill-others \"yarn dev\" \"yarn serve\"",
"svgSprite": "./.prep-icon.sh && ./.generate-sprite.sh",
"tdd": "karma start --autoWatch=true --reporters=mocha,notification --singleRun=false",
"test:Chrome": "karma start --singleRun=false --browsers Chrome",
"test:v:build": "yarn loch:build",
"test:v:buildFresh": "concurrently \"yarn build\" \"yarn test:v:build\"",
"test:v:clean": "yarn loch:clean",
"test:v:ref": "visualTest -e dev -c ./ -j src/defaults.json -t reference",
"test:v": "visualTest -e dev -c ./ -j src/defaults.json",
"test:visuals": "yarn test:v:clean && yarn build && yarn test:v:build && yarn test:v",
"test": "karma start --reporters=mocha",
"updateSprite": "yarn svgSprite && cp src/Icon/sprite.html dist/sprite.html && echo 'updated dist sprite'",
"updateStyles": "yarn dist && cp dist/styles.css dist/styles.scss && echo 'updated nessie dist styles'",
"jest-test": "jest-webpack"
},
"keywords": [
"scotland",
"nessie",
"react",
"css",
"javascript"
],
"repository": {
"type": "git",
"url": "git+https://github.com/sociomantic-tsunami/nessie.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/sociomantic-tsunami/nessie/issues"
},
"homepage": "https://github.com/sociomantic-tsunami/nessie#readme",
"devDependencies": {
"auto-changelog": "^1.4.5",
"autoprefixer": "^8.5.2",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^4.1.2",
"codemirror": "^5.35.0",
"concurrently": "^3.5.1",
"css-loader": "^0.28.11",
"enzyme": "^2.9.1",
"eslint": "^4.6.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-arca": "^0.6.0",
"eslint-plugin-compat": "^2.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.3.0",
"file-loader": "^1.1.11",
"flounder": "^1.3.5",
"identity-obj-proxy": "^3.0.0",
"jest": "^23.1.0",
"jest-codemods": "^0.15.0",
"jest-webpack": "^0.4.0",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sinon-chai": "^1.3.4",
"karma-webpack": "^3.0.0",
"loch-ness": "^2.2.2",
"lodash.isequal": "^4.5.0",
"lodash.merge": "^4.6.1",
"microbejs": "^0.5.2",
"mini-css-extract-plugin": "^0.4.0",
"mocha": "^5.2.0",
"normalize.css": "^8.0.0",
"null-loader": "^0.1.1",
"postcss": "^6.0.22",
"postcss-advanced-variables": "^2.3.3",
"postcss-attribute-case-insensitive": "^3.0.0",
"postcss-calc": "^6.0.1",
"postcss-color-function": "^4.0.1",
"postcss-custom-media": "^6.0.0",
"postcss-custom-properties": "^7.0.0",
"postcss-custom-selectors": "^4.0.1",
"postcss-extend": "^1.0.5",
"postcss-font-variant": "^3.0.0",
"postcss-initial": "^2.0.0",
"postcss-loader": "^2.1.5",
"postcss-media-minmax": "^3.0.0",
"postcss-nested": "^3.0.0",
"postcss-partial-import": "^4.1.0",
"postcss-pseudo-class-any-link": "^5.0.0",
"postcss-replace-overflow-wrap": "^2.0.0",
"postcss-selector-matches": "^3.0.1",
"postcss-selector-not": "^3.0.1",
"prop-types": "^15.5.8",
"raw-loader": "^0.5.1",
"react": "^15.6.2",
"react-addons-css-transition-group": "^15.6.2",
"react-dom": "^15.6.2",
"react-test-renderer": "^15.6.2",
"release-it": "^7.4.5",
"replace": "^1.0.0",
"rimraf": "^2.6.2",
"sinon": "^5.0.10",
"sinon-chai": "^3.1.0",
"svg-loader": "^0.0.2",
"svg-sprite-generator": "^0.0.7",
"svgo": "^0.7.2",
"url-loader": "^1.0.1",
"webpack": "^4.10.2",
"webpack-cli": "^2.1.4"
},
"dependencies": {}
}
Loading

0 comments on commit 69aed60

Please sign in to comment.