Sorry, the diff of this file is not supported yet
| // For a detailed explanation regarding each configuration property, visit: | ||
| // https://jestjs.io/docs/en/configuration.html | ||
| module.exports = { | ||
| // Automatically clear mock calls and instances between every test | ||
| // clearMocks: false, | ||
| // The directory where Jest should output its coverage files | ||
| coverageDirectory: "coverage", | ||
| transform: { | ||
| '^.+\\.js$': '<rootDir>test/jest.transform.js', | ||
| }, | ||
| // An array of regexp pattern strings used to skip coverage collection | ||
| coveragePathIgnorePatterns: [ | ||
| "/node_modules/" | ||
| ], | ||
| // An array of file extensions your modules use | ||
| moduleFileExtensions: [ | ||
| "js", | ||
| "json", | ||
| "jsx", | ||
| "ts", | ||
| "tsx", | ||
| "node" | ||
| ], | ||
| // A map from regular expressions to module names that allow to stub out resources with a single module | ||
| // moduleNameMapper: {}, | ||
| moduleNameMapper: { | ||
| "\\.(css|less|scss)$": "<rootDir>test/__mocks__/styleMock.js", | ||
| "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>test/__mocks__/fileMock.js" | ||
| }, | ||
| // A list of paths to modules that run some code to configure or set up the testing framework before each test | ||
| setupFilesAfterEnv: ["<rootDir>test/test-setup.js"], | ||
| // The test environment that will be used for testing | ||
| testEnvironment: "jsdom", | ||
| // The glob patterns Jest uses to detect test files | ||
| testMatch: [ | ||
| "**/__tests__/**/*.[jt]s?(x)", | ||
| "**/?(*.)+(spec|test).[tj]s?(x)" | ||
| ], | ||
| // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation | ||
| transformIgnorePatterns: [ | ||
| "/node_modules/" | ||
| ] | ||
| }; |
| import React from "react"; | ||
| import { shallow } from 'enzyme'; | ||
| import Hello from "../index.js"; | ||
| import { create } from 'react-test-renderer'; | ||
| // step one 初始化 | ||
| // describe("Hello",()=>{ | ||
| // it("snapshot initialize",()=>{ | ||
| // // https://reactjs.org/docs/test-renderer.html#testrendereract | ||
| // const root = create(<Hello />) | ||
| // expect(root.toJSON()).toMatchSnapshot(); | ||
| // }); | ||
| // }); | ||
| // https://enzymejs.github.io/enzyme/ | ||
| // 利用enzyme,进行浅渲染 | ||
| describe("Hello",()=>{ | ||
| it("shallow test props value",()=>{ | ||
| const cl = "youguess"; | ||
| const ShallowHello = shallow(<Hello className={cl} />); | ||
| // 调试方式 | ||
| // console.log(ShallowHello.debug()) | ||
| // console.log(ShallowHello.html()) | ||
| // console.log(ShallowHello.props()) | ||
| expect(ShallowHello.props().className).toBe(cl); | ||
| expect(ShallowHello.prop("className")).toBe(cl); | ||
| }); | ||
| it("shallow test props function(recommend)",()=>{ | ||
| const func = jest.fn(); | ||
| const ShallowHello = shallow(<Hello triggerFunction={func} />); | ||
| ShallowHello.invoke("triggerFunction")() | ||
| expect(func).toHaveBeenCalled(); | ||
| }); | ||
| it("shallow test props function throw simulate action (has no choice)",()=>{ | ||
| const func = jest.fn(); | ||
| const ShallowHello = shallow(<Hello onClick={func} />); | ||
| ShallowHello.simulate("click"); | ||
| expect(func).toHaveBeenCalled(); | ||
| }); | ||
| }); |
| module.exports = 'test-file-stub'; |
| module.exports = ""; |
| module.exports = require('babel-jest').createTransformer({ | ||
| presets: ['@babel/env', '@babel/react'] | ||
| }) |
| import 'react'; | ||
| import Adapter from 'enzyme-adapter-react-16'; | ||
| import Enzyme from 'enzyme'; | ||
| /** | ||
| * Set up Enzyme to mount to DOM, simulate events, | ||
| * and inspect the DOM in tests. | ||
| */ | ||
| Enzyme.configure({ adapter: new Adapter() }); | ||
+3
-7
@@ -1,9 +0,3 @@ | ||
| ## [1.0.5](https://github.com/nu-system/nu-cli/compare/v1.0.4...v1.0.5) (2020-04-15) | ||
| ## 1.0.7 (2020-04-18) | ||
| ### Features | ||
| - add react ([5ef4f34](https://github.com/nu-system/nu-cli/commit/5ef4f3434d268f512b3a06fbedb08c9e6e5fde50)) | ||
| ## [1.0.4](https://github.com/nu-system/nu-cli/compare/93e54a5d736cc87fef229188c1cd303c67ca56e4...v1.0.4) (2020-04-15) | ||
| ### Bug Fixes | ||
@@ -15,3 +9,5 @@ | ||
| - add react ([5ef4f34](https://github.com/nu-system/nu-cli/commit/5ef4f3434d268f512b3a06fbedb08c9e6e5fde50)) | ||
| - add test config ([8651156](https://github.com/nu-system/nu-cli/commit/86511561f0366e73a1a9549a5cf6ebd87eb6d0be)) | ||
| - update ([93e54a5](https://github.com/nu-system/nu-cli/commit/93e54a5d736cc87fef229188c1cd303c67ca56e4)) | ||
| - 更新 files ([0effa18](https://github.com/nu-system/nu-cli/commit/0effa18065333d869500f7a50c69c5fda1293673)) |
+7
-4
| { | ||
| "name": "@_nu/cli", | ||
| "version": "1.0.6", | ||
| "version": "1.0.7", | ||
| "description": "🛠️ Standard Tooling for nu-system component development", | ||
@@ -31,9 +31,11 @@ "main": "index.js", | ||
| "cz": "git add . && git cz", | ||
| "pub": "npm publish --access public", | ||
| "log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", | ||
| "commitizenInit": "commitizen init cz-conventional-changelog --yarn --dev --exact", | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,css,md,json}'" | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,css,md,json}'", | ||
| "prepublishOnly": "npm run log && npm run cz && git push" | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "npm run log && git add . && lint-staged" | ||
| "pre-commit": "lint-staged" | ||
| } | ||
@@ -43,3 +45,4 @@ }, | ||
| "*.{js,jsx,tsx,ts,less,css,md,json}": [ | ||
| "prettier --write" | ||
| "prettier --write", | ||
| "git add ." | ||
| ] | ||
@@ -46,0 +49,0 @@ }, |
@@ -32,9 +32,11 @@ { | ||
| "commit": "git add . && git cz", | ||
| "pub": "npm publish --access public", | ||
| "log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", | ||
| "commitizenInit": "commitizen init cz-conventional-changelog --yarn --dev --exact", | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,css,md,json}'" | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,css,md,json}'", | ||
| "prepublishOnly": "npm run build && npm run log && npm run cz && git push" | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "npm run log && git add . && lint-staged" | ||
| "pre-commit": "lint-staged" | ||
| } | ||
@@ -44,3 +46,4 @@ }, | ||
| "*.{js,json,md,less,css}": [ | ||
| "prettier --write" | ||
| "prettier --write", | ||
| "git add ." | ||
| ] | ||
@@ -47,0 +50,0 @@ }, |
@@ -21,9 +21,10 @@ { | ||
| "clean": "nwb clean-module && nwb clean-demo", | ||
| "prepublishOnly": "npm run build", | ||
| "start": "nwb serve-react-demo", | ||
| "test": "nwb test-react", | ||
| "test:coverage": "nwb test-react --coverage", | ||
| "test:watch": "nwb test-react --server", | ||
| "test": "jest", | ||
| "test:coverage": "jest --coverage", | ||
| "test:watch": "jest --server", | ||
| "log": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", | ||
| "commitizenInit": "commitizen init cz-conventional-changelog --yarn --dev --exact" | ||
| "commitizenInit": "commitizen init cz-conventional-changelog --yarn --dev --exact", | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,css,md,json}'", | ||
| "prepublishOnly": "npm run build && npm run log && npm run cz && git push" | ||
| }, | ||
@@ -36,3 +37,21 @@ "dependencies": { | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "lint-staged" | ||
| } | ||
| }, | ||
| "lint-staged": { | ||
| "*.{js,json,md,less,css}": [ | ||
| "prettier --write", | ||
| "git add ." | ||
| ] | ||
| }, | ||
| "devDependencies": { | ||
| "enzyme": "^3.11.0", | ||
| "enzyme-adapter-react-16": "^1.15.2", | ||
| "jest": "^25.1.0", | ||
| "babel-jest": "^25.1.0", | ||
| "@babel/preset-env": "^7.8.7", | ||
| "@babel/preset-react": "^7.8.3", | ||
| "react-test-renderer": "^16.13.1", | ||
| "conventional-changelog-cli": "^2.0.23", | ||
@@ -42,4 +61,8 @@ "cz-conventional-changelog": "3.0.2", | ||
| "react": "^16.8.6", | ||
| "react-dom": "^16.8.6" | ||
| "react-dom": "^16.8.6", | ||
| "husky": "^4.2.5", | ||
| "lint-staged": "^10.1.3", | ||
| "prettier": "^1.19.1" | ||
| }, | ||
| "keywords": [ | ||
@@ -46,0 +69,0 @@ "react-component", |
| var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
| function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| var Hello = function Hello(_ref) { | ||
| var className = _ref.className, | ||
| children = _ref.children, | ||
| otherProps = _objectWithoutProperties(_ref, ['className', 'children']); | ||
| return React.createElement( | ||
| 'div', | ||
| _extends({ className: '' + className }, otherProps), | ||
| children | ||
| ); | ||
| }; | ||
| Hello.propTypes = process.env.NODE_ENV !== "production" ? { | ||
| className: PropTypes.string, | ||
| children: PropTypes.node | ||
| } : {}; | ||
| Hello.defaultProps = { | ||
| className: '', | ||
| children: null | ||
| }; | ||
| export default Hello; |
| 'use strict'; | ||
| exports.__esModule = true; | ||
| var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
| var _react = require('react'); | ||
| var _react2 = _interopRequireDefault(_react); | ||
| var _propTypes = require('prop-types'); | ||
| var _propTypes2 = _interopRequireDefault(_propTypes); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
| var Hello = function Hello(_ref) { | ||
| var className = _ref.className, | ||
| children = _ref.children, | ||
| otherProps = _objectWithoutProperties(_ref, ['className', 'children']); | ||
| return _react2.default.createElement( | ||
| 'div', | ||
| _extends({ className: '' + className }, otherProps), | ||
| children | ||
| ); | ||
| }; | ||
| Hello.propTypes = process.env.NODE_ENV !== "production" ? { | ||
| className: _propTypes2.default.string, | ||
| children: _propTypes2.default.node | ||
| } : {}; | ||
| Hello.defaultProps = { | ||
| className: '', | ||
| children: null | ||
| }; | ||
| exports.default = Hello; | ||
| module.exports = exports['default']; |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
38
11.76%373
12.35%2
-50%32634
-92.19%