Skip to content

Commit a083e12

Browse files
authored
Merge pull request #122 from semantic-release/fix/custom-path
Fixed double path resolve and improved testing
2 parents 70cdcc1 + 88ddc2e commit a083e12

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

lib/prepare.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function prepare(
2525
? path.join(
2626
path.join(os.tmpdir(), `workDir-${config.workDir}`, config.slug),
2727
)
28-
: path.resolve(path.resolve(config.path));
28+
: path.resolve(config.path);
2929

3030
if (config.copyFiles) {
3131
await fs.mkdir(workDir, { recursive: true });

test/2-prepare-theme.spec.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ it('Should fail on a non-existant version file', async () => {
8787
});
8888

8989
it('Should fully prepare a theme for release', async () => {
90+
await fs.copy(
91+
'./test/fixtures/complete-theme',
92+
'./test/fixtures/complete-theme-copy',
93+
);
94+
9095
await prepare(
9196
{
9297
type: 'theme',
93-
slug: 'complete-theme',
94-
path: './test/fixtures/complete-theme',
95-
copyFiles: true,
98+
slug: 'complete-theme-copy',
99+
path: './test/fixtures/complete-theme-copy',
100+
copyFiles: false,
96101
withVersionFile: true,
97102
withAssets: true,
98103
versionFiles: ['functions.php'],
@@ -103,10 +108,10 @@ it('Should fully prepare a theme for release', async () => {
103108
context,
104109
);
105110

106-
const themeDir = fs.readdirSync('/tmp/wp-release/complete-theme');
111+
const themeDir = fs.readdirSync('/tmp/wp-release/complete-theme-copy');
107112
const assets = fs.readdirSync('/tmp/wp-release/assets');
108113
const versions = fs.readFileSync(
109-
'/tmp/workDir-1/complete-theme/functions.php',
114+
'./test/fixtures/complete-theme-copy/functions.php',
110115
'utf8',
111116
);
112117

@@ -126,4 +131,9 @@ it('Should fully prepare a theme for release', async () => {
126131
);
127132
expect(versions).toMatch(/1\.0\.0/);
128133
expect(versions).toMatch(/3\.2\.111/);
134+
135+
await fs.rm('./test/fixtures/complete-theme-copy', {
136+
recursive: true,
137+
force: true,
138+
});
129139
});

0 commit comments

Comments
 (0)