Files
react-native-devtools-frontend/scripts/build/tests/plugins_test.js
T
Tim van der Lippe 800d875627 Add build script tests
You can run these tests with `npm run build-test`, while we also run
them as part of our PRESUBMIT if we make any changes to the build
folder.

R=yangguo@chromium.org
CC=tikuta@chromium.org

Bug: 1293772
Change-Id: Id3b02c83398d2346a4ec5a06f3b938d33070d4f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3439987
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org>
2022-02-04 13:25:10 +00:00

31 lines
1.1 KiB
JavaScript

// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const {assert} = require('chai');
const path = require('path');
const {devtoolsPlugin} = require('../devtools_plugin.js');
describe('devtools_plugin can compute paths with', () => {
it('same directory import', () => {
assert.deepEqual(
devtoolsPlugin('./AnotherFile.js', 'front_end/core/sdk/FirstFile.js'),
{id: path.join('front_end', 'core', 'sdk', 'AnotherFile.js'), external: false});
});
it('different directory import', () => {
assert.deepEqual(
devtoolsPlugin('../common/common.js', 'front_end/core/sdk/FirstFile.js'),
{id: path.join('front_end', 'core', 'common', 'common.js'), external: true});
});
it('node built-in modules', () => {
assert.deepEqual(devtoolsPlugin('fs', 'scripts/some-script.js'), {id: 'fs', external: true});
});
it('importing generated files', () => {
assert.strictEqual(devtoolsPlugin('../../generated/Protocol.js', 'front_end/core/sdk/FirstFile.js'), null);
});
});