nx/packages/next/src/migrations/update-11-6-0/add-js-include-11-6-0.spec.ts
Kirils Ladovs aba5c44ec1
Tsconfig js migration (#4993)
* chore(gatsby): add migration to add js file patterns to tsconfig.app.json

* chore(nextjs): add migration to add js file patterns to tsconfig
2021-03-11 13:34:46 -05:00

42 lines
973 B
TypeScript

import { readJson, Tree, writeJson } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import addJsInclude from './add-js-include-11-6-0';
describe('Add js include 11.6.0', () => {
let tree: Tree;
beforeEach(async () => {
tree = createTreeWithEmptyWorkspace();
});
it('should add js patterns to tsconfig "include"', async () => {
writeJson(tree, 'workspace.json', {
projects: {
app1: {
root: 'apps/app1',
targets: {
build: {
executor: '@nrwl/next:build',
},
},
},
},
});
writeJson(tree, 'nx.json', {
projects: {
app1: {},
},
});
writeJson(tree, 'apps/app1/tsconfig.json', {
include: ['**/*.ts'],
});
await addJsInclude(tree);
expect(readJson(tree, 'apps/app1/tsconfig.json')).toMatchObject({
include: ['**/*.ts', '**/*.js', '**/*.jsx'],
});
});
});