Skip to content

Commit

Permalink
test: replace __filename
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Nov 1, 2023
1 parent dfb03f7 commit be27b8d
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 18 deletions.
3 changes: 2 additions & 1 deletion test/nuts/REST/deploy.mpd.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand Down Expand Up @@ -76,7 +77,7 @@ context(`MPD REST Deploy NUTs [name: ${repo.name}]`, () => {
process.env.SFDX_REST_DEPLOY = 'true';
testkit = await SourceTestkit.create({
repository: repo.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
});

Expand Down
3 changes: 2 additions & 1 deletion test/nuts/REST/deploy.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand Down Expand Up @@ -50,7 +51,7 @@ context(`REST Deploy NUTs [name: ${repo.name}]`, () => {
process.env.SFDX_REST_DEPLOY = 'true';
testkit = await SourceTestkit.create({
repository: repo.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.deploy({ args: '-p force-app' });
});
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/deployDestructive.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { expect } from 'chai';
import { execCmd } from '@salesforce/cli-plugins-testkit';
import { SourceTestkit } from '@salesforce/source-testkit';
Expand Down Expand Up @@ -33,7 +34,7 @@ describe('source:deploy --destructive NUTs', () => {

before(async () => {
testkit = await SourceTestkit.create({
nut: __filename,
nut: fileURLToPath(import.meta.url),
repository: 'https://github.com/trailheadapps/dreamhouse-lwc.git',
});
execCmd('force:source:deploy --sourcepath force-app', { ensureExitCode: 0 });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.async.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { getBoolean, getString } from '@salesforce/ts-types';
import { Result } from '@salesforce/source-testkit/lib/types.js';
Expand All @@ -23,7 +24,7 @@ context('Async Deploy NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
// an initial deploy to initialize testkit source tracking
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.manifest.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand All @@ -20,7 +21,7 @@ context('Deploy manifest NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
// some deploys reference other metadata not included in the deploy, if it's not already in the org it will fail
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.metadata.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand All @@ -19,7 +20,7 @@ context('Deploy metadata NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
// some deploys reference other metadata not included in the deploy, if it's not already in the org it will fail
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.quick.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand All @@ -19,7 +20,7 @@ context('Quick Deploy NUTs [name: %REPO_NAME%] [exec: %EXECUTABLE%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
});

Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.sourcepath.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { get } from '@salesforce/ts-types';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
Expand All @@ -20,7 +21,7 @@ context('Deploy sourcepath NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
});

Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/deploy.testlevel.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js';

Expand All @@ -17,7 +18,7 @@ context('Deploy testlevel NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });

Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/mpd.deploy.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';

context('MPD Deploy NUTs', () => {
Expand All @@ -13,7 +14,7 @@ context('MPD Deploy NUTs', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: 'https://github.com/salesforcecli/sample-project-multiple-packages.git',
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
});

Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/mpd.retrieve.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import path from 'node:path';
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { Dictionary } from '@salesforce/ts-types';
import { SourceTestkit } from '@salesforce/source-testkit';

Expand All @@ -16,7 +17,7 @@ context('MPD Retrieve NUTs', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: 'https://github.com/salesforcecli/sample-project-multiple-packages.git',
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.trackGlobs(testkit.packageGlobs);
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
5 changes: 3 additions & 2 deletions test/nuts/seeds/retrieve.manifest.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url'; // DO NOT TOUCH. generateNuts.ts will insert these values
import { SourceTestkit } from '@salesforce/source-testkit';
import { JsonMap } from '@salesforce/ts-types';
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js'; // DO NOT TOUCH. generateNuts.ts will insert these values
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js';

// DO NOT TOUCH. generateNuts.ts will insert these values
const REPO = TEST_REPOS_MAP.get('%REPO_URL%') as RepoConfig;
Expand All @@ -19,7 +20,7 @@ context('Retrieve manifest NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.trackGlobs(testkit.packageGlobs);
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/retrieve.metadata.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { JsonMap } from '@salesforce/ts-types';
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js';
Expand All @@ -19,7 +20,7 @@ context('Retrieve metadata NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.trackGlobs(testkit.packageGlobs);
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/retrieve.packagenames.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { exec } from 'shelljs';

Expand All @@ -18,7 +19,7 @@ context('Retrieve packagenames NUTs', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: 'https://github.com/salesforcecli/sample-project-multiple-packages.git',
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
});
Expand Down
3 changes: 2 additions & 1 deletion test/nuts/seeds/retrieve.retrievetargetdir.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { fileURLToPath } from 'node:url';
import { SourceTestkit } from '@salesforce/source-testkit';
import { JsonMap } from '@salesforce/ts-types';
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js';
Expand All @@ -18,7 +19,7 @@ context('Retrieve metadata NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.trackGlobs(testkit.packageGlobs);
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down
5 changes: 3 additions & 2 deletions test/nuts/seeds/retrieve.sourcepath.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*/

import path from 'node:path';
import { fileURLToPath } from 'node:url'; // DO NOT TOUCH. generateNuts.ts will insert these values
import { SourceTestkit } from '@salesforce/source-testkit';
import { JsonMap } from '@salesforce/ts-types';
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js'; // DO NOT TOUCH. generateNuts.ts will insert these values
import { RepoConfig, TEST_REPOS_MAP } from '../testMatrix.js';

// DO NOT TOUCH. generateNuts.ts will insert these values
const REPO = TEST_REPOS_MAP.get('%REPO_URL%') as RepoConfig;
Expand All @@ -19,7 +20,7 @@ context('Retrieve Sourcepath NUTs [name: %REPO_NAME%]', () => {
before(async () => {
testkit = await SourceTestkit.create({
repository: REPO.gitUrl,
nut: __filename,
nut: fileURLToPath(import.meta.url),
});
await testkit.trackGlobs(testkit.packageGlobs);
await testkit.deploy({ args: `--sourcepath ${testkit.packageNames.join(',')}` });
Expand Down

0 comments on commit be27b8d

Please sign in to comment.