Update sample project and unit tests (#1709)
* Add React Native 0.65.0 to sample project * Increase packageLoaderTestTimeout * Bump VS Code version to 1.62.3 in unit tests * Rename sample project to sampleReactNativeProject
This commit is contained in:
Родитель
5fb1d932ac
Коммит
3c116e195d
|
@ -31,7 +31,7 @@ const tsProject = ts.createProject("tsconfig.json");
|
|||
*/
|
||||
const isNightly = process.argv.includes("--nightly");
|
||||
|
||||
const vscodeVersionForTests = "1.61.0";
|
||||
const vscodeVersionForTests = "1.62.3";
|
||||
|
||||
const fullExtensionName = isNightly
|
||||
? "msjsdiag.vscode-react-native-preview"
|
||||
|
@ -76,7 +76,7 @@ const options = minimist(process.argv.slice(2), knownOptions);
|
|||
let lintSources = [srcPath, testPath].map(tsFolder => tsFolder + "/**/*.ts");
|
||||
lintSources = lintSources.concat([
|
||||
"!src/typings/**",
|
||||
"!test/resources/sampleReactNative022Project/**",
|
||||
"!test/resources/sampleReactNativeProject/**",
|
||||
"!test/smoke/**",
|
||||
"!/SmokeTestLogs/**",
|
||||
]);
|
||||
|
@ -291,7 +291,7 @@ gulp.task("check-copyright", () => {
|
|||
"!node_modules/**",
|
||||
"!test/**/*.js",
|
||||
"!SampleApplication/**",
|
||||
"!test/resources/sampleReactNative022Project/**/*.js",
|
||||
"!test/resources/sampleReactNativeProject/**/*.js",
|
||||
"!test/smoke/package/node_modules/**",
|
||||
"!test/smoke/automation/node_modules/**",
|
||||
"!test/smoke/resources/**",
|
||||
|
@ -363,7 +363,7 @@ gulp.task("clean", () => {
|
|||
"test/**/*.js.map",
|
||||
"out/",
|
||||
"dist",
|
||||
"!test/resources/sampleReactNative022Project/**/*.js",
|
||||
"!test/resources/sampleReactNativeProject/**/*.js",
|
||||
".vscode-test/",
|
||||
"nls.*.json",
|
||||
"!test/smoke/**/*",
|
||||
|
|
|
@ -1606,9 +1606,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"big-integer": {
|
||||
"version": "1.6.48",
|
||||
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz",
|
||||
"integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==",
|
||||
"version": "1.6.51",
|
||||
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
|
||||
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",
|
||||
"dev": true
|
||||
},
|
||||
"big.js": {
|
||||
|
@ -4216,6 +4216,12 @@
|
|||
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
||||
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
|
||||
"dev": true
|
||||
},
|
||||
"anymatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
|
||||
|
@ -4312,6 +4318,12 @@
|
|||
"binary-extensions": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||
"dev": true
|
||||
},
|
||||
"is-glob": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||
|
@ -4374,6 +4386,7 @@
|
|||
"strip-json-comments": "3.1.1",
|
||||
"supports-color": "8.1.1",
|
||||
"which": "2.0.2",
|
||||
"wide-align": "1.1.3",
|
||||
"workerpool": "6.1.0",
|
||||
"yargs": "16.2.0",
|
||||
"yargs-parser": "20.2.4",
|
||||
|
@ -4463,6 +4476,36 @@
|
|||
"readable-stream": "3"
|
||||
}
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"string-width": "^1.0.2 || 2"
|
||||
},
|
||||
"dependencies": {
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-fullwidth-code-point": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
||||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"workerpool": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz",
|
||||
|
@ -9669,9 +9712,9 @@
|
|||
}
|
||||
},
|
||||
"vscode-test": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.5.2.tgz",
|
||||
"integrity": "sha512-x9PVfKxF6EInH9iSFGQi0V8H5zIW1fC7RAer6yNQR6sy3WyOwlWkuT3I+wf75xW/cO53hxMi1aj/EvqQfDFOAg==",
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz",
|
||||
"integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"http-proxy-agent": "^4.0.1",
|
||||
|
|
|
@ -1209,7 +1209,7 @@
|
|||
"vsce": "^2.2.0",
|
||||
"vscode-debugprotocol": "1.40.0",
|
||||
"vscode-nls-dev": "3.3.2",
|
||||
"vscode-test": "^1.5.2",
|
||||
"vscode-test": "^1.6.1",
|
||||
"webpack": "5.28.0",
|
||||
"webpack-bundle-analyzer": "4.4.0"
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@ import { PackageLoader, PackageConfig } from "../../src/common/packageLoader";
|
|||
import { CommandExecutor } from "../../src/common/commandExecutor";
|
||||
import { HostPlatform } from "../../src/common/hostPlatform";
|
||||
|
||||
const packageLoaderTestTimeout = 1000 * 60;
|
||||
const packageLoaderTestTimeout = 5 * 60 * 1000;
|
||||
// We need to import xdlInterface to import PackageLoad correctly.
|
||||
// Probably a problem is related to import of static functions into test files
|
||||
console.log(XDL);
|
||||
|
@ -38,7 +38,7 @@ suite("packageLoader", async () => {
|
|||
__dirname,
|
||||
"..",
|
||||
"resources",
|
||||
"sampleReactNative022Project",
|
||||
"sampleReactNativeProject",
|
||||
);
|
||||
const sampleProjectNodeModulesPath = path.join(sampleProjectPath, "node_modules");
|
||||
const sampleProjectPackageLockJsonPath = path.join(sampleProjectPath, "package-lock.json");
|
||||
|
@ -83,6 +83,7 @@ suite("packageLoader", async () => {
|
|||
});
|
||||
|
||||
suiteTeardown(function () {
|
||||
this.timeout(packageLoaderTestTimeout);
|
||||
findFileInFolderHierarchyStub?.restore();
|
||||
getVersionFromExtensionNodeModulesStub?.restore();
|
||||
tryToRequireAfterInstallSpy?.restore();
|
||||
|
@ -93,6 +94,7 @@ suite("packageLoader", async () => {
|
|||
});
|
||||
|
||||
teardown(function () {
|
||||
this.timeout(packageLoaderTestTimeout);
|
||||
findFileInFolderHierarchyStub?.reset();
|
||||
getVersionFromExtensionNodeModulesStub?.reset();
|
||||
tryToRequireAfterInstallSpy?.reset();
|
||||
|
|
|
@ -11,28 +11,28 @@ import * as fs from "fs";
|
|||
import { ParsedPackage } from "../../src/common/reactNativeProjectHelper";
|
||||
|
||||
suite("projectVersionHelper", function () {
|
||||
const sampleReactNative022ProjectDir = path.join(
|
||||
const sampleReactNativeProjectDir = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"resources",
|
||||
"sampleReactNative022Project",
|
||||
"sampleReactNativeProject",
|
||||
);
|
||||
|
||||
const nodeModulesRoot: string = sampleReactNative022ProjectDir;
|
||||
const nodeModulesRoot: string = sampleReactNativeProjectDir;
|
||||
|
||||
test("getReactNativeVersionsFromProjectPackage should return object containing version strings if 'version' field is found in project's package.json file", async () => {
|
||||
let additionalPackages: ParsedPackage[] = [];
|
||||
additionalPackages.push(REACT_NATIVE_PACKAGES.REACT_NATIVE_WINDOWS);
|
||||
const versions = await ProjectVersionHelper.getReactNativeVersionsFromProjectPackage(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
additionalPackages,
|
||||
);
|
||||
assert.strictEqual(versions.reactNativeVersion, "0.22.2");
|
||||
assert.strictEqual(versions.reactNativeWindowsVersion, "0.60.0-vnext.68");
|
||||
assert.strictEqual(versions.reactNativeVersion, "0.65.0");
|
||||
assert.strictEqual(versions.reactNativeWindowsVersion, "0.65.9");
|
||||
});
|
||||
|
||||
suite("getReactNativeVersionsFromProjectWithIncorrectPackageJson", () => {
|
||||
const packageJsonPath = path.join(sampleReactNative022ProjectDir, "package.json");
|
||||
const packageJsonPath = path.join(sampleReactNativeProjectDir, "package.json");
|
||||
const packageJsonContent = fs.readFileSync(packageJsonPath, "utf8");
|
||||
const versionObj = {
|
||||
devDependencies: {},
|
||||
|
@ -50,7 +50,7 @@ suite("projectVersionHelper", function () {
|
|||
let additionalPackages: ParsedPackage[] = [];
|
||||
additionalPackages.push(REACT_NATIVE_PACKAGES.REACT_NATIVE_WINDOWS);
|
||||
const versions = await ProjectVersionHelper.getReactNativeVersionsFromProjectPackage(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
additionalPackages,
|
||||
);
|
||||
assert.strictEqual(
|
||||
|
@ -66,12 +66,12 @@ suite("projectVersionHelper", function () {
|
|||
|
||||
suite("getReactNativeVersionsFromNodeModules", () => {
|
||||
const reactNativePackageDir = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"node_modules",
|
||||
"react-native",
|
||||
);
|
||||
const reactNativeWindowsPackageDir = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"node_modules",
|
||||
"react-native-windows",
|
||||
);
|
||||
|
@ -84,7 +84,7 @@ suite("projectVersionHelper", function () {
|
|||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, "node_modules"),
|
||||
path.join(sampleReactNativeProjectDir, "node_modules"),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@ import { ReactNativeProjectHelper } from "../../src/common/reactNativeProjectHel
|
|||
|
||||
suite("ReactNativeProjectHelper", function () {
|
||||
const fsHelper = new Node.FileSystem();
|
||||
const sampleReactNative022ProjectDir = path.join(
|
||||
const sampleReactNativeProjectDir = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"resources",
|
||||
"sampleReactNative022Project",
|
||||
"sampleReactNativeProject",
|
||||
);
|
||||
|
||||
suite("isAndroidHermesEnabled", () => {
|
||||
const buildGradleFilePath = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"android",
|
||||
"app",
|
||||
"build.gradle",
|
||||
|
@ -29,9 +29,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
});
|
||||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, "android"),
|
||||
);
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNativeProjectDir, "android"));
|
||||
});
|
||||
|
||||
test("isAndroidHermesEnabled should return 'true' if Hermes engine is enabled in the build.gradle file", () => {
|
||||
|
@ -40,7 +38,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(buildGradleFilePath, buildGradleFileContent);
|
||||
|
||||
const androidHermesEnabled = ReactNativeProjectHelper.isAndroidHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(androidHermesEnabled, true);
|
||||
|
@ -52,7 +50,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(buildGradleFilePath, buildGradleFileContent);
|
||||
|
||||
const androidHermesEnabled = ReactNativeProjectHelper.isAndroidHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(androidHermesEnabled, false);
|
||||
|
@ -63,7 +61,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(buildGradleFilePath, buildGradleFileContent);
|
||||
|
||||
const androidHermesEnabled = ReactNativeProjectHelper.isAndroidHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(androidHermesEnabled, false);
|
||||
|
@ -71,14 +69,14 @@ suite("ReactNativeProjectHelper", function () {
|
|||
});
|
||||
|
||||
suite("isIOSHermesEnabled", () => {
|
||||
const podfileFilePath = path.join(sampleReactNative022ProjectDir, "ios", "Podfile");
|
||||
const podfileFilePath = path.join(sampleReactNativeProjectDir, "ios", "Podfile");
|
||||
|
||||
suiteSetup(() => {
|
||||
fsHelper.makeDirectoryRecursiveSync(path.dirname(podfileFilePath));
|
||||
});
|
||||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNative022ProjectDir, "ios"));
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNativeProjectDir, "ios"));
|
||||
});
|
||||
|
||||
test("isIOSHermesEnabled should return 'true' if Hermes engine is enabled in the Podfile file", () => {
|
||||
|
@ -91,7 +89,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const iOSHermesEnabled = ReactNativeProjectHelper.isIOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(iOSHermesEnabled, true);
|
||||
|
@ -107,7 +105,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const iOSHermesEnabled = ReactNativeProjectHelper.isIOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(iOSHermesEnabled, false);
|
||||
|
@ -119,7 +117,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const iOSHermesEnabled = ReactNativeProjectHelper.isIOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(iOSHermesEnabled, false);
|
||||
|
@ -127,14 +125,14 @@ suite("ReactNativeProjectHelper", function () {
|
|||
});
|
||||
|
||||
suite("isMacOSHermesEnabled", () => {
|
||||
const podfileFilePath = path.join(sampleReactNative022ProjectDir, "macos", "Podfile");
|
||||
const podfileFilePath = path.join(sampleReactNativeProjectDir, "macos", "Podfile");
|
||||
|
||||
suiteSetup(() => {
|
||||
fsHelper.makeDirectoryRecursiveSync(path.dirname(podfileFilePath));
|
||||
});
|
||||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNative022ProjectDir, "macos"));
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNativeProjectDir, "macos"));
|
||||
});
|
||||
|
||||
test("isMacOSHermesEnabled should return 'true' if the 'hermes_enabled' parameter in the Podfile file is uncommented and equal to 'true'", () => {
|
||||
|
@ -150,7 +148,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const macOSHermesEnabled = ReactNativeProjectHelper.isMacOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(macOSHermesEnabled, true);
|
||||
|
@ -175,7 +173,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const macOSHermesEnabled = ReactNativeProjectHelper.isMacOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(macOSHermesEnabled, true);
|
||||
|
@ -194,7 +192,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const macOSHermesEnabled = ReactNativeProjectHelper.isMacOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(macOSHermesEnabled, false);
|
||||
|
@ -208,7 +206,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(podfileFilePath, podfileFileContent);
|
||||
|
||||
const macOSHermesEnabled = ReactNativeProjectHelper.isMacOSHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(macOSHermesEnabled, false);
|
||||
|
@ -217,7 +215,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
|
||||
suite("isWindowsHermesEnabled", () => {
|
||||
const experimentalFeaturesFilePath = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"windows",
|
||||
"ExperimentalFeatures.props",
|
||||
);
|
||||
|
@ -227,9 +225,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
});
|
||||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, "windows"),
|
||||
);
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNativeProjectDir, "windows"));
|
||||
});
|
||||
|
||||
test("isWindowsHermesEnabled should return 'true' if Hermes engine is enabled in the ExperimentalFeatures.props file", () => {
|
||||
|
@ -246,7 +242,7 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(experimentalFeaturesFilePath, experimentalFeaturesFileContent);
|
||||
|
||||
const windowsHermesEnabled = ReactNativeProjectHelper.isWindowsHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(windowsHermesEnabled, true);
|
||||
|
@ -266,18 +262,16 @@ suite("ReactNativeProjectHelper", function () {
|
|||
fs.writeFileSync(experimentalFeaturesFilePath, experimentalFeaturesFileContent);
|
||||
|
||||
const windowsHermesEnabled = ReactNativeProjectHelper.isWindowsHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
|
||||
assert.strictEqual(windowsHermesEnabled, false);
|
||||
});
|
||||
|
||||
test("isWindowsHermesEnabled should return 'fasle' if there is no the ExperimentalFeatures.props file", () => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, "windows"),
|
||||
);
|
||||
fsHelper.removePathRecursivelySync(path.join(sampleReactNativeProjectDir, "windows"));
|
||||
const windowsHermesEnabled = ReactNativeProjectHelper.isWindowsHermesEnabled(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
assert.strictEqual(windowsHermesEnabled, false);
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as assert from "assert";
|
|||
import { AndroidPlatform } from "../../../src/extension/android/androidPlatform";
|
||||
import { IAndroidRunOptions, PlatformType } from "../../../src/extension/launchArgs";
|
||||
import { FileSystem } from "../../../src/common/node/fileSystem";
|
||||
import { ReactNative022 } from "../../resources/reactNative022";
|
||||
import { ReactNative065 } from "../../resources/reactNative065";
|
||||
import * as adb from "../../../src/extension/android/adb";
|
||||
import { RecordingsHelper } from "../../resources/recordingsHelper";
|
||||
import { CommandExecutor } from "../../../src/common/commandExecutor";
|
||||
|
@ -45,10 +45,10 @@ suite("androidPlatform", function () {
|
|||
nodeModulesRoot,
|
||||
};
|
||||
|
||||
const rnProjectContent = fs.readFileSync(ReactNative022.DEFAULT_PROJECT_FILE, "utf8");
|
||||
const rnProjectContent = fs.readFileSync(ReactNative065.DEFAULT_PROJECT_FILE, "utf8");
|
||||
|
||||
let fileSystem: FileSystem;
|
||||
let reactNative: ReactNative022;
|
||||
let reactNative: ReactNative065;
|
||||
let androidPlatform: AndroidPlatform;
|
||||
|
||||
let launchAppStub: Sinon.SinonStub;
|
||||
|
@ -113,7 +113,7 @@ suite("androidPlatform", function () {
|
|||
return;
|
||||
});
|
||||
|
||||
reactNative = new ReactNative022(fileSystem, adbHelper);
|
||||
reactNative = new ReactNative065(fileSystem, adbHelper);
|
||||
|
||||
getReactNativeProjectRootStub = sinon.stub(
|
||||
SettingsHelper,
|
||||
|
|
|
@ -21,11 +21,11 @@ suite("commandExecutor", function () {
|
|||
|
||||
let appLauncherStub: Sinon.SinonStub;
|
||||
let Log = new ConsoleLogger();
|
||||
const sampleReactNative022ProjectDir = path.join(
|
||||
const sampleReactNativeProjectDir = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"resources",
|
||||
"sampleReactNative022Project",
|
||||
"sampleReactNativeProject",
|
||||
);
|
||||
|
||||
let nodeModulesRoot: string;
|
||||
|
@ -54,7 +54,7 @@ suite("commandExecutor", function () {
|
|||
(projectRoot: string) => nodeModulesRoot,
|
||||
);
|
||||
|
||||
nodeModulesRoot = sampleReactNative022ProjectDir;
|
||||
nodeModulesRoot = sampleReactNativeProjectDir;
|
||||
});
|
||||
|
||||
test("should execute a command", async function () {
|
||||
|
@ -137,7 +137,7 @@ suite("commandExecutor", function () {
|
|||
|
||||
suite("getReactNativeVersion", () => {
|
||||
const reactNativePackageDir = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"node_modules",
|
||||
"react-native",
|
||||
);
|
||||
|
@ -149,17 +149,17 @@ suite("commandExecutor", function () {
|
|||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, "node_modules"),
|
||||
path.join(sampleReactNativeProjectDir, "node_modules"),
|
||||
);
|
||||
});
|
||||
|
||||
test("getReactNativeVersion should return version string if 'version' field is found in react-native package package.json file from node_modules", async () => {
|
||||
const commandExecutor: CommandExecutor = new CommandExecutor(
|
||||
nodeModulesRoot,
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
const versionObj = {
|
||||
version: "^0.22.0",
|
||||
version: "0.65.0",
|
||||
};
|
||||
|
||||
fs.writeFileSync(
|
||||
|
@ -168,13 +168,13 @@ suite("commandExecutor", function () {
|
|||
);
|
||||
|
||||
const version = await commandExecutor.getReactNativeVersion();
|
||||
assert.strictEqual(version, "0.22.0");
|
||||
assert.strictEqual(version, "0.65.0");
|
||||
});
|
||||
|
||||
test("getReactNativeVersion should return version string if there isn't 'version' field in react-native package's package.json file", async () => {
|
||||
const commandExecutor: CommandExecutor = new CommandExecutor(
|
||||
nodeModulesRoot,
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
const testObj = {
|
||||
test: "test",
|
||||
|
@ -186,7 +186,7 @@ suite("commandExecutor", function () {
|
|||
);
|
||||
|
||||
const version = await commandExecutor.getReactNativeVersion();
|
||||
assert.strictEqual(version, "0.22.2");
|
||||
assert.strictEqual(version, "0.65.0");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -197,14 +197,14 @@ suite("commandExecutor", function () {
|
|||
|
||||
test("selectReactNativeCLI should return local CLI", (done: Mocha.Done) => {
|
||||
const localCLIPath = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
"node_modules",
|
||||
".bin",
|
||||
"react-native",
|
||||
);
|
||||
let commandExecutor: CommandExecutor = new CommandExecutor(
|
||||
nodeModulesRoot,
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
CommandExecutor.ReactNativeCommand =
|
||||
RNGlobalCLINameContent["react-native-tools.reactNativeGlobalCommandName"];
|
||||
|
@ -219,7 +219,7 @@ suite("commandExecutor", function () {
|
|||
] = randomHash;
|
||||
let commandExecutor: CommandExecutor = new CommandExecutor(
|
||||
nodeModulesRoot,
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
);
|
||||
CommandExecutor.ReactNativeCommand =
|
||||
RNGlobalCLINameContent["react-native-tools.reactNativeGlobalCommandName"];
|
||||
|
|
|
@ -22,14 +22,14 @@ suite("rn-extension", function () {
|
|||
suite("createAdditionalWorkspaceFolder returns a new workspace folder", function () {
|
||||
const fsHelper = new Node.FileSystem();
|
||||
const nodeModulesFolderName: string = "node_modules";
|
||||
const sampleReactNative022ProjectDir = path.join(
|
||||
const sampleReactNativeProjectDir = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"resources",
|
||||
"sampleReactNative022Project",
|
||||
"sampleReactNativeProject",
|
||||
);
|
||||
const nodeModulesDir: string = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
nodeModulesFolderName,
|
||||
);
|
||||
|
||||
|
@ -39,7 +39,7 @@ suite("rn-extension", function () {
|
|||
|
||||
suiteTeardown(() => {
|
||||
fsHelper.removePathRecursivelySync(
|
||||
path.join(sampleReactNative022ProjectDir, nodeModulesFolderName),
|
||||
path.join(sampleReactNativeProjectDir, nodeModulesFolderName),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ suite("rn-extension", function () {
|
|||
|
||||
const innerProjectName: string = "innerSampleProject";
|
||||
const innerProjectDir: string = path.join(
|
||||
sampleReactNative022ProjectDir,
|
||||
sampleReactNativeProjectDir,
|
||||
innerProjectName,
|
||||
);
|
||||
const innerNodeModulesDir: string = path.join(
|
||||
|
|
|
@ -20,7 +20,7 @@ async function launchTests() {
|
|||
extensionDevelopmentPath,
|
||||
extensionTestsPath,
|
||||
launchArgs: ["--locale", "ru"],
|
||||
version: "1.61.0",
|
||||
version: "1.62.3",
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
|
|
@ -12,12 +12,11 @@ import { Recording, Simulator } from "./processExecution/simulator";
|
|||
import { AdbHelper } from "../../src/extension/android/adb";
|
||||
import { APKSerializer } from "./simulators/apkSerializer";
|
||||
|
||||
const sampleRNProjectPath = path.join(__dirname, "sampleReactNative022Project");
|
||||
const sampleRNProjectPath = path.join(__dirname, "sampleReactNativeProject");
|
||||
const processExecutionsRecordingsPath = path.join(__dirname, "processExecutionsRecordings");
|
||||
|
||||
/* This class simulates calling the React-Native CLI v0.22. It currently supports react-native init
|
||||
and react-native run-android. */
|
||||
export class ReactNative022 {
|
||||
// This class simulates calling the React-Native CLI v0.65.
|
||||
export class ReactNative065 {
|
||||
public static DEFAULT_PROJECT_FILE = path.join(sampleRNProjectPath, "package.json");
|
||||
|
||||
private static ANDROID_APK_RELATIVE_PATH = "android/app/build/outputs/apk/app-debug.apk";
|
||||
|
@ -134,7 +133,7 @@ export class ReactNative022 {
|
|||
.then(() => {
|
||||
this.androidAPKPath = path.join(
|
||||
this.projectRoot,
|
||||
ReactNative022.ANDROID_APK_RELATIVE_PATH,
|
||||
ReactNative065.ANDROID_APK_RELATIVE_PATH,
|
||||
);
|
||||
return new APKSerializer(this.fileSystem).writeApk(this.androidAPKPath, {
|
||||
packageName: this.androidPackageName,
|
||||
|
@ -204,6 +203,6 @@ export class ReactNative022 {
|
|||
|
||||
private readDefaultProjectFile(): Promise<string | Buffer> {
|
||||
const realFileSystem = new FileSystem(); // We always use the real file system (not the mock one) to read the sample project
|
||||
return realFileSystem.readFile(ReactNative022.DEFAULT_PROJECT_FILE);
|
||||
return realFileSystem.readFile(ReactNative065.DEFAULT_PROJECT_FILE);
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"name": "sampleReactNative022Project",
|
||||
"name": "sampleReactNativeProject",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^0.14.7",
|
||||
"react-native": "^0.22.2",
|
||||
"react-native-windows": "~0.60.0-vnext.68"
|
||||
"react": "17.0.2",
|
||||
"react-native": "0.65.0",
|
||||
"react-native-windows": "0.65.9"
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ async function launchTests() {
|
|||
await runTests({
|
||||
extensionDevelopmentPath,
|
||||
extensionTestsPath,
|
||||
version: "1.61.0",
|
||||
version: "1.62.3",
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"SampleApplication/.vscode",
|
||||
"ReactTypings",
|
||||
"tools/",
|
||||
"test/resources/sampleReactNative022Project/",
|
||||
"test/resources/sampleReactNativeProject",
|
||||
"test/smoke/"
|
||||
],
|
||||
"compileOnSave": false,
|
||||
|
|
Загрузка…
Ссылка в новой задаче