Skip to content

Commit

Permalink
Revert "refactor: use resolove to find imports in tests (#715)" (#730)
Browse files Browse the repository at this point in the history
This reverts commit b0a6a18.

Co-authored-by: Daniel Azuma <[email protected]>
  • Loading branch information
bcoe and dazuma authored Feb 2, 2021
1 parent a9f1cfe commit 8dab7bf
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import {
PREdge,
} from './graphql-to-commits';
import {Update} from './updaters/update';
import {resolve} from 'path';

// Short explanation of this regex:
// - skip the owner tag (e.g. googleapis)
Expand Down Expand Up @@ -154,7 +153,7 @@ export class GitHub {
baseUrl: this.apiUrl,
headers: {
'user-agent': `release-please/${
require(resolve('package.json')).version
require('../../package.json').version
}`,
// some proxies do not require the token prefix.
Authorization: `${this.proxyKey ? '' : 'token '}${this.token}`,
Expand Down
2 changes: 1 addition & 1 deletion test/github-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {GitHubRelease} from '../src/github-release';
const fixturesPath = './test/fixtures';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const repoInfo = require(resolve('./test/fixtures/repo-get-2.json'));
const repoInfo = require('../../test/fixtures/repo-get-2.json');

describe('GitHubRelease', () => {
describe('createRelease', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/release-pr-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('ReleasePRFactory', () => {
// check for default branch
.get('/repos/googleapis/simple-test-repo')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-2.json')))
.reply(200, require('../../test/fixtures/repo-get-2.json'))
// this step tries to close any existing PRs; just return an empty list.
.get('/repos/googleapis/simple-test-repo/pulls?state=open&per_page=100')
.reply(200, [])
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('ReleasePRFactory', () => {
// check for default branch
.get('/repos/googleapis/simple-test-repo')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-2.json')))
.reply(200, require('../../test/fixtures/repo-get-2.json'))
// this step tries to close any existing PRs; just return an empty list.
.get('/repos/googleapis/simple-test-repo/pulls?state=open&per_page=100')
.reply(200, [])
Expand Down
2 changes: 1 addition & 1 deletion test/release-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe('Release-PR', () => {
// check for default branch
.get('/repos/googleapis/release-please')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')))
.reply(200, require('../../test/fixtures/repo-get-1.json'))
// this step tries to close any existing PRs; just return an empty list.
.get('/repos/googleapis/release-please/pulls?state=open&per_page=100')
.reply(200, []);
Expand Down
6 changes: 3 additions & 3 deletions test/releasers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function mockRequest(snapName: string, requestPrefix = '') {
// check for default branch
.get('/repos/googleapis/node-test-repo')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('test/fixtures/repo-get-1.json')))
.reply(200, require('../../../test/fixtures/repo-get-1.json'))
.get(
'/repos/googleapis/node-test-repo/pulls?state=closed&per_page=100&sort=created&direction=desc'
)
Expand Down Expand Up @@ -251,7 +251,7 @@ describe('Node', () => {
const req = nock('https://api.github.com')
.get('/repos/googleapis/node-test-repo')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')))
.reply(200, require('../../../test/fixtures/repo-get-1.json'))
.get(
'/repos/googleapis/node-test-repo/contents/package.json?ref=refs/heads/master'
)
Expand All @@ -273,7 +273,7 @@ describe('Node', () => {
const req = nock('https://api.github.com')
.get('/repos/googleapis/node-test-repo')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')))
.reply(200, require('../../../test/fixtures/repo-get-1.json'))
.get(
'/repos/googleapis/node-test-repo/contents/some-path%2Fpackage.json?ref=refs/heads/master'
)
Expand Down
6 changes: 3 additions & 3 deletions test/releasers/yoshi-go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('YoshiGo', () => {
// check for default branch
.get('/repos/googleapis/google-cloud-go')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')))
.reply(200, require('../../../test/fixtures/repo-get-1.json'))
// create release
.post(
'/repos/googleapis/google-cloud-go/issues/22/labels',
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('YoshiGo', () => {
// check for default branch
.get('/repos/googleapis/google-api-go-client')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')));
.reply(200, require('../../../test/fixtures/repo-get-1.json'));

const pr = await releasePR.run();
assert.strictEqual(pr, 22);
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('YoshiGo', () => {
// check for default branch
.get('/repos/googleapis/google-cloud-go')
// eslint-disable-next-line @typescript-eslint/no-var-requires
.reply(200, require(resolve('./test/fixtures/repo-get-1.json')));
.reply(200, require('../../../test/fixtures/repo-get-1.json'));

const pr = await releasePR.run();
assert.strictEqual(pr, 22);
Expand Down

0 comments on commit 8dab7bf

Please sign in to comment.