Skip to content

Commit

Permalink
REVERT changes to angular require-context (BROKEN)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Aug 15, 2018
1 parent 850b083 commit 1209703
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
7 changes: 1 addition & 6 deletions examples/angular-cli/.storybook/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ import { configure } from '@storybook/angular';
import { setOptions } from '@storybook/addon-options';
import addCssWarning from '../src/cssWarning';

const path =require('path');
const rc = require('require-context');

addCssWarning();

setOptions({
hierarchyRootSeparator: /\|/,
});

const pathToStories = path.join(__dirname, '../src/stories');

function loadStories() {
// put welcome screen at the top of the list so it's the first one displayed
require('../src/stories');

// automatically import all story ts files that end with *.stories.ts
const req = rc(pathToStories, true, /\.stories\.ts$/);
const req = require.context('../src/stories', true, /\.stories\.ts$/);
req.keys().forEach(filename => req(filename));
}

Expand Down
2 changes: 2 additions & 0 deletions examples/angular-cli/jest-config/setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import 'jest-preset-angular';
import './globalMocks';

require('babel-plugin-require-context-hook/register')();
22 changes: 22 additions & 0 deletions examples/angular-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@
"test:generate-output": "jest --json --outputFile=addon-jest.testresults.json || true",
"test:watch": "jest --watch"
},
"jest": {
"coveragePathIgnorePatterns": [
"/jest-config/",
"/node_modules/"
],
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "./jest-config/setup.ts",
"snapshotSerializers": [
"<rootDir>/../../node_modules/jest-preset-angular/AngularSnapshotSerializer.js",
"<rootDir>/../../node_modules/jest-preset-angular/HTMLCommentSerializer.js"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/build/",
"/storybook-static/",
"angularshots.test.js"
],
"transform": {
".(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js",
"^.+\\.(ts|js|html)$": "<rootDir>/../../node_modules/jest-preset-angular/preprocessor.js"
}
},
"dependencies": {
"@angular/common": "^6.1.1",
"@angular/compiler": "^6.1.1",
Expand Down

0 comments on commit 1209703

Please sign in to comment.