Remove integration tests now in vercel/turbo (#52413)

These tests were moved into vercel/turbo in https://github.com/vercel/turbo/pull/5415.
This commit is contained in:
Will Binns-Smith 2023-07-07 13:35:07 -07:00 committed by GitHub
parent d11aafb740
commit d660bc906f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
165 changed files with 0 additions and 1696 deletions

View file

@ -1,7 +0,0 @@
import value from './node.js'
import indirect from './dir/indirect.js'
it('should alias with browser field', () => {
expect(value).toBe(42)
expect(indirect).toBe(42)
})

View file

@ -1,5 +0,0 @@
{
"browser": {
"./node.js": "./browser.js"
}
}

View file

@ -1,103 +0,0 @@
it('importing a not existing file should throw', () => {
// This is a check to make sure that the following tests would fail if they require("fail")
expect(() => {
require('./not-existing-file')
}).toThrow()
})
function maybeReturn(x) {
if (x) {
return true
}
}
function func() {
if (false) {
require('fail')
import('fail')
}
if (true) {
require('./ok')
}
if (true) {
require('./ok')
} else {
require('fail')
import('fail')
}
if (false) {
require('fail')
import('fail')
} else {
require('./ok')
}
}
it('should not follow conditional references', () => {
func()
expect(func.toString()).not.toContain('import(')
})
it('should allow to mutate objects', () => {
const obj = { a: true, b: false }
if (!obj.a) {
throw new Error('should not be executed')
}
if (obj.b) {
throw new Error('should not be executed')
}
function changeIt(o) {
o.a = false
o.b = true
}
changeIt(obj)
if (obj.a) {
throw new Error('should not be executed')
}
if (!obj.b) {
throw new Error('should not be executed')
}
})
it('should allow replacements in IIFEs', () => {
;(function func() {
if (false) {
require('fail')
import('fail')
}
})()
})
it('should support functions that only sometimes return', () => {
let ok = false
if (maybeReturn(true)) {
ok = true
}
expect(ok).toBe(true)
})
it('should evaluate process.turbopack', () => {
let ok = false
if (process.turbopack) {
ok = true
} else {
require('fail')
import('fail')
}
expect(ok).toBe(true)
})
it('should evaluate !process.turbopack', () => {
if (!process.turbopack) {
require('fail')
import('fail')
}
})
it('should evaluate NODE_ENV', () => {
if (process.env.NODE_ENV !== 'development') {
require('fail')
import('fail')
}
})

View file

@ -1,16 +0,0 @@
module.exports = {}
function f() {
if (!process.turbopack) {
throw new Error('Turbopack is not enabled')
}
if (process.env.NODE_ENV !== 'development') {
throw new Error('NODE_ENV is not development')
}
}
f()
// if (f.toString().includes("process.turbopack")) {
// throw new Error("process.turbopack is not replaced");
// }

View file

@ -1,28 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve relative \"./not-existing-file\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./not-existing-file\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js",
},
start: SourcePos {
line: 3,
column: 5,
},
end: SourcePos {
line: 4,
column: 0,
},
},
),
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,6 +0,0 @@
it('should throw a good error when parsing file fails', async () => {
await expect(import('./broken')).rejects.toMatchObject({
message:
"Could not parse module '[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/error/input/broken.js'",
})
})

View file

@ -1,14 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/error/input/broken.js",
category: "parse",
title: "Reading source code for parsing failed",
description: "An unexpected error happened while trying to read the source code to parse: failed to convert rope into string\n\nCaused by:\n- invalid utf-8 sequence of 1 bytes from index 1",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,17 +0,0 @@
import * as ns from './non-enumerable.js'
it('should allow to access non-enumerable inherited properties', () => {
const test = Object(ns)
expect(test.named).toEqual('named')
expect(test.default).toMatchObject({
named: 'named',
default: 'default',
})
expect(test).toMatchObject({
named: 'named',
default: expect.objectContaining({
named: 'named',
default: 'default',
}),
})
})

View file

@ -1,11 +0,0 @@
class X {
get named() {
return 'named'
}
get default() {
return 'default'
}
}
module.exports = new X()

View file

@ -1,37 +0,0 @@
import { esm, esmPlain, loadInvalidCjs, loadInvalidEsm } from 'esm-package'
import { auto, autoPlain } from 'auto-package'
it('should have the commonjs module as default export in specified ESM', () => {
expect(esm).toMatchObject({
__esModule: true,
named: 'named',
})
expect(esmPlain).toMatchObject({
named: 'named',
})
})
it('should not have the commonjs module as default export in specified ESM', () => {
expect(auto).toMatchObject({
__esModule: true,
named: 'named',
})
expect(autoPlain).toMatchObject({
named: 'named',
})
})
it('should error for invalid esm exports', async () => {
let value = await loadInvalidEsm()
expect(value).toMatchObject({
__esModule: true,
})
})
it('should error for invalid cjs exports', async () => {
let value = await loadInvalidCjs()
expect(value).toMatchObject({
__esModule: true,
named: 'named',
})
})

View file

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.named = "named";

View file

@ -1,5 +0,0 @@
import m from "./commonjs.js";
import m2 from "./plain.js";
export const auto = m;
export const autoPlain = m2;

View file

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.named = "named";

View file

@ -1,11 +0,0 @@
import m from "./commonjs.cjs";
import m2 from "./plain.cjs";
export const esm = m;
export const esmPlain = m2;
export function loadInvalidEsm() {
return import("./invalid-exports.js");
}
export function loadInvalidCjs() {
return import("./invalid-exports.cjs");
}

View file

@ -1,14 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.cjs",
category: "module type",
title: "Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules)",
description: "The CommonJs module format was specified in the package.json that is affecting this source file or by using an special extension, but Ecmascript import/export syntax is used in the source code.\nThe module was automatically converted to an EcmaScript module, but that is in conflict with the specified module format. Either change the \"type\" field in the package.json or replace EcmaScript import/export syntax with CommonJs syntas in the source file.\nIn some cases EcmaScript import/export syntax is added by an transform and isn't actually part of the source code. In these cases revisit transformation options to inject the correct syntax.",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,14 +0,0 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.js",
category: "module type",
title: "Specified module format (EcmaScript Modules) is not matching the module format of the source code (CommonJs)",
description: "The EcmaScript module format was specified in the package.json that is affecting this source file or by using an special extension, but it looks like that CommonJs syntax is used in the source code.\nExports made by CommonJs syntax will lead to a runtime error, since the module is in EcmaScript mode. Either change the \"type\" field in the package.json or replace CommonJs syntax with EcmaScript import/export syntax in the source file.",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,3 +0,0 @@
it('polyfills `global` to `globalThis`', () => {
expect(global).toBe(globalThis)
})

View file

@ -1,52 +0,0 @@
import def, { named } from './module.js'
import {
nested,
nested2,
nested_with_identity,
nested_with_identity2,
double_nested,
double_nested2,
double_nested_with_identity,
double_nested_with_identity2,
} from './reexport.js'
it('support imports in shorthand properties', () => {
expect(def).toBe('default')
expect(named).toBe('named')
expect({ def }).toStrictEqual({ def: 'default' })
expect({ named }).toStrictEqual({ named: 'named' })
expect(nested).toStrictEqual({ def: 'default', named: 'named' })
expect(nested2).toStrictEqual({ def: 'default', named: 'named' })
expect(nested_with_identity).toStrictEqual({
def: 'default',
named: 'named',
})
expect(nested_with_identity2).toStrictEqual({
def: 'default',
named: 'named',
})
expect(double_nested).toStrictEqual({
nested: {
def: 'default',
named: 'named',
},
})
expect(double_nested2).toStrictEqual({
nested: {
def: 'default',
named: 'named',
},
})
expect(double_nested_with_identity).toStrictEqual({
nested: {
def: 'default',
named: 'named',
},
})
expect(double_nested_with_identity2).toStrictEqual({
nested: {
def: 'default',
named: 'named',
},
})
})

View file

@ -1,5 +0,0 @@
export const named = 'named'
export default 'default'
export function identity(x) {
return x
}

View file

@ -1,56 +0,0 @@
import def, { named, identity } from './module.js'
const nested = {
def,
named,
}
export const nested2 = {
def,
named,
}
const nested_with_identity = identity({
def,
named,
})
export const nested_with_identity2 = identity({
def,
named,
})
const double_nested = {
nested: {
def,
named,
},
}
export const double_nested2 = {
nested: {
def,
named,
},
}
const double_nested_with_identity = {
nested: identity({
def,
named,
}),
}
export const double_nested_with_identity2 = {
nested: identity({
def,
named,
}),
}
export {
nested,
nested_with_identity,
double_nested,
double_nested_with_identity,
}

View file

@ -1,19 +0,0 @@
it('runs sync tests', () => {
expect(true).toBe(true)
})
it('runs async tests', async () => {
await Promise.resolve()
expect(true).toBe(true)
})
describe('nested describe', () => {
it('runs sync tests', () => {
expect(true).toBe(true)
})
it('runs async tests', async () => {
await Promise.resolve()
expect(true).toBe(true)
})
})

View file

@ -1,3 +0,0 @@
it('runs give an empty object for an ignored module', () => {
expect(require('package')).toEqual({})
})

View file

@ -1 +0,0 @@
throw new Error("An ignored module should not be executed")

View file

@ -1 +0,0 @@
module.exports = require("./ignored.js")

View file

@ -1,5 +0,0 @@
{
"browser": {
"./ignored.js": false
}
}

View file

@ -1,5 +0,0 @@
import value from 'package'
it('follows module aliases in alias field', () => {
expect(value).toBe(42)
})

View file

@ -1,6 +0,0 @@
{
"main": "src/index.js",
"browser": {
"other-package": "./other-replacement.js"
}
}

View file

@ -1 +0,0 @@
export { default } from "other-package";

View file

@ -1,20 +0,0 @@
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,16 +0,0 @@
it('should handle circular chunks correctly', function (done) {
import(/* webpackChunkName: "a" */ './module-a')
.then(function (result) {
return result.default()
})
.then(function (result2) {
expect(result2.default()).toBe('x')
done()
})
.catch(function (e) {
done(e)
})
const couldBe = function () {
return import(/* webpackChunkName: "b" */ './module-b')
}
})

View file

@ -1,3 +0,0 @@
export default function () {
return import(/* webpackChunkName: "c" */ './module-c')
}

View file

@ -1,5 +0,0 @@
import './module-x'
export default function () {
return import(/* webpackChunkName: "c" */ './module-c')
}

View file

@ -1,9 +0,0 @@
import x from './module-x'
export default function () {
if (Math.random() < -1) {
import(/* webpackChunkName: "a" */ './module-a')
import(/* webpackChunkName: "b" */ './module-b')
}
return x
}

View file

@ -1,29 +0,0 @@
it("should not bundle context requires with asyncMode === 'weak'", function () {
var contextRequire = require.context('.', false, /two/, 'weak')
expect(function () {
contextRequire('./two')
}).toThrowError(/not available/)
})
it("should not bundle context requires with asyncMode === 'weak' using import.meta.webpackContext", function () {
const contextRequire = import.meta.webpackContext('.', {
recursive: false,
regExp: /two/,
mode: 'weak',
})
expect(function () {
contextRequire('./two')
}).toThrowError(/not available/)
})
it("should find module with asyncMode === 'weak' when required elsewhere", function () {
var contextRequire = require.context('.', false, /.+/, 'weak')
expect(contextRequire('./three')).toBe(3)
require('./three') // in a real app would be served as a separate chunk
})
it("should find module with asyncMode === 'weak' when required elsewhere (recursive)", function () {
var contextRequire = require.context('.', true, /.+/, 'weak')
expect(contextRequire('./dir/four')).toBe(4)
require('./dir/four') // in a real app would be served as a separate chunk
})

View file

@ -1,28 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", false, /two/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
detail: "",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 1,
column: 23,
},
end: SourcePos {
line: 1,
column: 23,
},
},
),
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,28 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", false, /.+/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
detail: "",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 19,
column: 23,
},
end: SourcePos {
line: 19,
column: 23,
},
},
),
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,28 +0,0 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", true, /.+/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
detail: "",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 25,
column: 23,
},
end: SourcePos {
line: 25,
column: 23,
},
},
),
sub_issues: [],
processing_path: Some(
[],
),
}

View file

@ -1,9 +0,0 @@
it('should also work in a chunk', function (done) {
require.ensure([], function (require) {
var contextRequire = require.context('.', false, /two/)
expect(contextRequire('./two')).toBe(2)
var tw = 'tw'
expect(require('.' + '/' + tw + 'o')).toBe(2)
done()
})
})

View file

@ -1,42 +0,0 @@
function testCase(load, done) {
load('two', 2, function () {
var sync = true
load('one', 1, function () {
expect(sync).toBe(false)
load('three', 3, function () {
var sync = true
load('two', 2, function () {
expect(sync).toBe(true)
done()
})
Promise.resolve()
.then(function () {})
.then(function () {})
.then(function () {
sync = false
})
})
})
Promise.resolve().then(function () {
sync = false
})
})
}
it('should be able to use expressions in import', function (done) {
function load(name, expected, callback) {
import('./dir/' + name)
.then(function (result) {
expect(result).toEqual(
nsObj({
default: expected,
})
)
callback()
})
.catch(function (err) {
done(err)
})
}
testCase(load, done)
})

View file

@ -1,9 +0,0 @@
export const c = 'c'
export const d = 'd'
export const longnameforexport = 'longnameforexport'
export default 'default2'
export const usedExports = __webpack_exports_info__.usedExports

View file

@ -1,7 +0,0 @@
export const c = 'c'
export const d = 'd'
export default 'default2'
export const usedExports = __webpack_exports_info__.usedExports

View file

@ -1,7 +0,0 @@
export const a = 'a'
export const b = 'b'
export default 'default'
export const usedExports = __webpack_exports_info__.usedExports

Some files were not shown because too many files have changed in this diff Show more