forked from graphql/graphql-js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrationTests: Add test for webpack
Motivated by graphql#3178
- Loading branch information
1 parent
40db639
commit 310d7ad
Showing
6 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const { buildSchema, graphqlSync } = require('graphql'); | ||
|
||
const schema = buildSchema('type Query { hello: String }'); | ||
|
||
const result = graphqlSync({ | ||
schema, | ||
source: '{ hello }', | ||
rootValue: { hello: 'world' }, | ||
}); | ||
|
||
module.exports = { result }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"test": "webpack && node test.js" | ||
}, | ||
"dependencies": { | ||
"graphql": "file:../graphql.tgz", | ||
"webpack": "5.x.x", | ||
"webpack-cli": "4.x.x" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
// eslint-disable-next-line node/no-missing-require | ||
const { result } = require('./dist/main.js'); | ||
|
||
assert.deepStrictEqual(result, { | ||
data: { | ||
__proto__: null, | ||
hello: 'world', | ||
}, | ||
}); | ||
console.log('Test script: Got correct result from Webpack bundle!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"mode": "production", | ||
"entry": "./entry.js", | ||
"output": { | ||
"libraryTarget": "commonjs2" | ||
} | ||
} |