Skip to content

Commit

Permalink
Fix TextEncoder workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed May 26, 2024
1 parent 51f9739 commit b3fdba2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/.changeset/
/.devcontainer/
/packages/apollo-angular/CHANGELOG.md

# Needed because TextEncoder workaround must happen before importing @angular-devkit/schematics
/packages/apollo-angular/schematics/tests/ng-add.spec.ts
/packages/apollo-angular/schematics/tests/utils.spec.ts
8 changes: 4 additions & 4 deletions packages/apollo-angular/schematics/tests/ng-add.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TextDecoder, TextEncoder } from 'util';
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder as any;

import { CompilerOptions } from 'typescript';
import { UnitTestTree } from '@angular-devkit/schematics/testing';
import { createDependenciesMap } from '../install';
import { getFileContent, getJsonFile, runNgAdd } from '../utils';

const { TextEncoder, TextDecoder } = require('util');
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;

describe('ng-add with module', () => {
let tree: UnitTestTree;

Expand Down
8 changes: 4 additions & 4 deletions packages/apollo-angular/schematics/tests/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { parseJSON } from '../utils';

const { TextEncoder, TextDecoder } = require('util');
import { TextDecoder, TextEncoder } from 'util';
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
global.TextDecoder = TextDecoder as any;

import { parseJSON } from '../utils';

test('support // comments', () => {
expect(
Expand Down

0 comments on commit b3fdba2

Please sign in to comment.