mirror of
https://github.com/swc-project/swc.git
synced 2024-09-11 16:55:27 +03:00
refactor(bundler): Improve test suite (#3144)
This commit is contained in:
parent
bf820b7937
commit
8a1016fb40
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -2,3 +2,4 @@
|
||||
path = crates/swc_ecma_parser/tests/test262-parser
|
||||
url = https://github.com/tc39/test262-parser-tests.git
|
||||
shallow = true
|
||||
ignore = dirty
|
@ -6,12 +6,7 @@
|
||||
use self::common::*;
|
||||
use anyhow::Error;
|
||||
use ntest::timeout;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::write,
|
||||
path::PathBuf,
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
use std::{collections::HashMap, fs::write, path::PathBuf, process::Command};
|
||||
use swc_atoms::js_word;
|
||||
use swc_bundler::{Bundler, Load, ModuleRecord};
|
||||
use swc_common::{collections::AHashSet, FileName, Mark, Span, GLOBALS};
|
||||
@ -1011,15 +1006,18 @@ fn run(url: &str, exports: &[&str]) {
|
||||
.arg("run")
|
||||
.arg("--no-check")
|
||||
.arg(&path)
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.status()
|
||||
.unwrap();
|
||||
.output()
|
||||
.expect("failed to get output from deno");
|
||||
|
||||
std::mem::forget(dir);
|
||||
if !output.status.success() {
|
||||
std::mem::forget(dir);
|
||||
|
||||
dbg!(output);
|
||||
assert!(output.success());
|
||||
panic!(
|
||||
"failed to execute:\n{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn bundle(url: &str, minify: bool) -> String {
|
||||
@ -1211,14 +1209,18 @@ fn exec(input: PathBuf) {
|
||||
.arg("--no-check")
|
||||
.arg("--allow-net")
|
||||
.arg(&path)
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.status()
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
std::mem::forget(dir);
|
||||
if !output.status.success() {
|
||||
std::mem::forget(dir);
|
||||
|
||||
assert!(output.success());
|
||||
panic!(
|
||||
"failed to execute:\n{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[testing::fixture("tests/deno-exec/**/entry.ts")]
|
||||
@ -1252,12 +1254,16 @@ fn exec_minified(input: PathBuf) {
|
||||
.arg("--no-check")
|
||||
.arg("--allow-net")
|
||||
.arg(&path)
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.status()
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
std::mem::forget(dir);
|
||||
if !output.status.success() {
|
||||
std::mem::forget(dir);
|
||||
|
||||
assert!(output.success());
|
||||
panic!(
|
||||
"failed to execute:\n{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,3 @@
|
||||
import * as mongo from "https://deno.land/x/mongo@v0.27.0/mod.ts";
|
||||
import MongoClient = mongo.MongoClient;
|
||||
const mongoClient = new MongoClient();
|
@ -0,0 +1,3 @@
|
||||
import * as mongo from "https://deno.land/x/mongo@v0.27.0/mod.ts";
|
||||
var MongoClient = mongo.MongoClient;
|
||||
const mongoClient = new MongoClient();
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env zsh
|
||||
set -eu
|
||||
|
||||
find . -type d -empty -delete
|
||||
|
Loading…
Reference in New Issue
Block a user