Skip to content

Commit 0b06899

Browse files
committed
tests: Transpile tests less aggressively
Makes tests easier to debug
1 parent e2a6f23 commit 0b06899

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

.babelrc.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
module.exports = {
2-
presets: ['@babel/preset-env'],
2+
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
33
plugins: [
44
'./resources/inline-invariant',
55
'@babel/plugin-transform-flow-strip-types',
6-
['@babel/plugin-transform-classes', { loose: true }],
7-
['@babel/plugin-transform-destructuring', { loose: true }],
8-
['@babel/plugin-transform-spread', { loose: true }],
9-
['@babel/plugin-transform-for-of', { assumeArray: true }],
106
],
11-
env: {
12-
cjs: {
13-
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
7+
overrides: [
8+
{
9+
exclude: ['**/__tests__/**/*', '**/__fixtures__/**/*'],
10+
presets: ['@babel/preset-env'],
11+
plugins: [
12+
['@babel/plugin-transform-classes', { loose: true }],
13+
['@babel/plugin-transform-destructuring', { loose: true }],
14+
['@babel/plugin-transform-spread', { loose: true }],
15+
['@babel/plugin-transform-for-of', { assumeArray: true }],
16+
],
17+
env: {
18+
cjs: {
19+
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
20+
},
21+
mjs: {
22+
presets: [['@babel/preset-env', { modules: false }]],
23+
},
24+
},
1425
},
15-
mjs: {
16-
presets: [['@babel/preset-env', { modules: false }]],
17-
},
18-
},
26+
],
1927
};

src/execution/__tests__/schema-test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,19 @@ describe('Execute: Handles execution with a complex schema', () => {
9191
return {
9292
id,
9393
isPublished: true,
94-
author: johnSmith,
94+
author: {
95+
id: 123,
96+
name: 'John Smith',
97+
pic: (width, height) => getPic(123, width, height),
98+
recentArticle: () => article(1),
99+
},
95100
title: 'My Article ' + id,
96101
body: 'This is a post',
97102
hidden: 'This data is not exposed in the schema',
98103
keywords: ['foo', 'bar', 1, true, null],
99104
};
100105
}
101106

102-
const johnSmith = {
103-
id: 123,
104-
name: 'John Smith',
105-
pic: (width, height) => getPic(123, width, height),
106-
recentArticle: article(1),
107-
};
108-
109107
function getPic(uid, width, height) {
110108
return {
111109
url: `cdn://${uid}`,

0 commit comments

Comments
 (0)