Update some tests (#13176)

* Revert "Disable a test (#13159)"

This reverts commit 26cf77a5d5.

* remove a test case
This commit is contained in:
liuxingbaoyu authored and GitHub committed 2022-07-26 11:30:41 +09:00
1 parent 581ec3c3f8
commit 3680bb79e1
6 files changed
+192 -16

No files matched your search

-2
View File
@@ -52,8 +52,6 @@ const espreeDisabledTests = new Set(
[
// These tests only work for `babel`
"comments-closure-typecast",
// Unknown reason https://github.com/babel/babel/pull/14779#discussion_r928137651
"strings",
].map((directory) => path.join(__dirname, "../format/js", directory))
);
const acornDisabledTests = espreeDisabledTests;
@@ -1,5 +1,49 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`non-octal-eight-and-nine.js [acorn] format 1`] = `
"Invalid escape sequence (3:3)
1 | // https://github.com/babel/babel/pull/11852
2 |
> 3 | "\\8","\\9";
| ^
4 | () => {
5 | "use strict";
6 | "\\8", "\\9";"
`;
exports[`non-octal-eight-and-nine.js [espree] format 1`] = `
"Invalid escape sequence (3:3)
1 | // https://github.com/babel/babel/pull/11852
2 |
> 3 | "\\8","\\9";
| ^
4 | () => {
5 | "use strict";
6 | "\\8", "\\9";"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [acorn] format 1`] = `
"Invalid escape sequence (3:3)
1 | // https://github.com/babel/babel/pull/11852
2 |
> 3 | "\\8","\\9";
| ^
4 | () => {
5 | "use strict";
6 | "\\8", "\\9";"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1`] = `
"Invalid escape sequence (3:3)
1 | // https://github.com/babel/babel/pull/11852
2 |
> 3 | "\\8","\\9";
| ^
4 | () => {
5 | "use strict";
6 | "\\8", "\\9";"
`;
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = `
====================================options=====================================
parsers: ["babel", "flow"]
+13 -2
View File
@@ -1,2 +1,13 @@
run_spec(import.meta, ["babel", "flow"]);
run_spec(import.meta, ["babel", "flow"], { trailingComma: "all" });
run_spec(import.meta, ["babel", "flow"], {
errors: {
acorn: ["non-octal-eight-and-nine.js"],
espree: ["non-octal-eight-and-nine.js"],
},
});
run_spec(import.meta, ["babel", "flow"], {
trailingComma: "all",
errors: {
acorn: ["non-octal-eight-and-nine.js"],
espree: ["non-octal-eight-and-nine.js"],
},
});
@@ -140,9 +140,6 @@ parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
// valid JSX
<in T>() => {}</in>;
type Covariant<out T> = {
x: T;
}
@@ -206,9 +203,6 @@ declare class StateNode<TContext, in out TEvent extends { type: string }> {
}
=====================================output=====================================
// valid JSX
<in T>() => {}</in>;
type Covariant<out T> = {
x: T;
};
@@ -283,3 +277,137 @@ exports[`with-jsx.tsx [typescript] format 1`] = `
4 | type Covariant<out T> = {
5 | x: T;"
`;
exports[`with-jsx.tsx format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
type Covariant<out T> = {
x: T;
}
type Contravariant<in T> = {
f: (x: T) => void;
}
type Invariant<in out T> = {
f: (x: T) => T;
}
type T10<out T> = T;
type T11<in T> = keyof T;
type T12<out T, out K extends keyof T> = T[K];
type T13<in out T> = T[keyof T];
type Covariant1<in T> = {
x: T;
}
type Contravariant1<out T> = keyof T;
type Contravariant2<out T> = {
f: (x: T) => void;
}
type Invariant1<in T> = {
f: (x: T) => T;
}
type Invariant2<out T> = {
f: (x: T) => T;
}
type Foo1<in T> = {
x: T;
f: FooFn1<T>;
}
type Foo2<out T> = {
x: T;
f: FooFn2<T>;
}
type Foo3<in out T> = {
x: T;
f: FooFn3<T>;
}
type T21<in out T> = T;
interface Baz<out T> {}
interface Baz<in T> {}
interface Parent<out A> {
child: Child<A> | null;
parent: Parent<A> | null;
}
declare class StateNode<TContext, in out TEvent extends { type: string }> {
_storedEvent: TEvent;
_action: ActionObject<TEvent>;
_state: StateNode<TContext, any>;
}
=====================================output=====================================
type Covariant<out T> = {
x: T;
};
type Contravariant<in T> = {
f: (x: T) => void;
};
type Invariant<in out T> = {
f: (x: T) => T;
};
type T10<out T> = T;
type T11<in T> = keyof T;
type T12<out T, out K extends keyof T> = T[K];
type T13<in out T> = T[keyof T];
type Covariant1<in T> = {
x: T;
};
type Contravariant1<out T> = keyof T;
type Contravariant2<out T> = {
f: (x: T) => void;
};
type Invariant1<in T> = {
f: (x: T) => T;
};
type Invariant2<out T> = {
f: (x: T) => T;
};
type Foo1<in T> = {
x: T;
f: FooFn1<T>;
};
type Foo2<out T> = {
x: T;
f: FooFn2<T>;
};
type Foo3<in out T> = {
x: T;
f: FooFn3<T>;
};
type T21<in out T> = T;
interface Baz<out T> {}
interface Baz<in T> {}
interface Parent<out A> {
child: Child<A> | null;
parent: Parent<A> | null;
}
declare class StateNode<TContext, in out TEvent extends { type: string }> {
_storedEvent: TEvent;
_action: ActionObject<TEvent>;
_state: StateNode<TContext, any>;
}
================================================================================
`;
@@ -1,3 +1 @@
run_spec(import.meta, ["typescript"], {
errors: { typescript: ["with-jsx.tsx"] },
});
run_spec(import.meta, ["typescript"]);
@@ -1,6 +1,3 @@
// valid JSX
<in T>() => {}</in>;
type Covariant<out T> = {
x: T;
}