Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove colors from the the result to fix the local test #225

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/checks/PrismaClientOnContext.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gql from 'graphql-tag'
import { objectType, queryType } from 'nexus'
import { testIntegration, TestIntegrationParams, testIntegrationPartial } from '../__helpers__/testers'
import { ansiEscapeSequencePattern } from '../../utils/ansiEscapeSequencePattern'

const base = testIntegrationPartial({
database: `
Expand Down Expand Up @@ -96,7 +97,10 @@ describe('instanceOf_duckType_fallback strategy:', () => {
// The emitted error contains a path that isn't stable across the CI/CI matrix. Needs to be processed.
expect(result) {
if (result.logs[0]) {
result.logs[0] = result.logs[0]!.replace(/(.*imported from).*(is not the.*)/, '$1 <dynamic_path> $2')
result.logs[0] = result.logs[0]!.replace(
/(.*imported from).*(is not the.*)/,
'$1 <dynamic_path> $2'
).replace(ansiEscapeSequencePattern, '')
}
expect(result.logs).toMatchSnapshot(`logs`)
expect(result.graphqlSchemaSDL).toMatchSnapshot(`graphqlSchemaSDL`)
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
".nexus-prisma": [".nexus-prisma"]
}
},
"include": ["src", "tests", "scripts"],
"include": ["src", "tests", "scripts", "utils"],
"exclude": ["dist-*", "tests/e2e/fixtures", "docs"]
}
5 changes: 5 additions & 0 deletions utils/ansiEscapeSequencePattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @see https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
*/
// eslint-disable-next-line no-control-regex
export const ansiEscapeSequencePattern = /\x1b\[[0-9]+m/g