Skip to content

Commit

Permalink
Change default entrypoint to stripe.node (#1670)
Browse files Browse the repository at this point in the history
  • Loading branch information
anniel-stripe authored Feb 2, 2023
1 parent b5fc448 commit ecec2f2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 20 deletions.
2 changes: 0 additions & 2 deletions lib/stripe.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
"types": "./types/index.d.ts",
"browser": "./lib/stripe.worker.js",
"worker": "./lib/stripe.worker.js",
"default": "./lib/stripe.js"
"default": "./lib/stripe.node.js"
}
}
1 change: 0 additions & 1 deletion src/stripe.ts

This file was deleted.

4 changes: 2 additions & 2 deletions test/RequestSender.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('RequestSender', () => {

describe('Parameter encoding', () => {
// Use a real instance of stripe as we're mocking the http.request responses.
const realStripe = require('../lib/stripe')(utils.getUserStripeKey());
const realStripe = require('../lib/stripe.node')(utils.getUserStripeKey());

after(() => {
nock.cleanAll();
Expand Down Expand Up @@ -334,7 +334,7 @@ describe('RequestSender', () => {

describe('Retry Network Requests', () => {
// Use a real instance of stripe as we're mocking the http.request responses.
const realStripe = require('../lib/stripe')(utils.getUserStripeKey());
const realStripe = require('../lib/stripe.node')(utils.getUserStripeKey());

// Override the sleep timer to speed up tests
realStripe.charges._getSleepTimeInMS = () => 0;
Expand Down
4 changes: 2 additions & 2 deletions test/StripeResource.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('StripeResource', () => {
};

it('is not impacted by the global host', (done) => {
const stripe = require('../lib/stripe')('sk_test', {
const stripe = require('../lib/stripe.node')('sk_test', {
host: 'bad.host.stripe.com',
});

Expand All @@ -122,7 +122,7 @@ describe('StripeResource', () => {
});

it('still lets users override the host on a per-request basis', (done) => {
const stripe = require('../lib/stripe')('sk_test');
const stripe = require('../lib/stripe.node')('sk_test');

const scope = nock('https://some.other.host.stripe.com')
.get('/v1/resourceWithHost')
Expand Down
5 changes: 4 additions & 1 deletion test/flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

const testUtils = require('../testUtils');
const chai = require('chai');
const stripe = require('../lib/stripe')(testUtils.getUserStripeKey(), 'latest');
const stripe = require('../lib/stripe.node')(
testUtils.getUserStripeKey(),
'latest'
);
const fs = require('fs');
const path = require('path');
const stream = require('stream');
Expand Down
2 changes: 1 addition & 1 deletion test/net/NodeHttpClient.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const http = require('http');
const expect = require('chai').expect;

const {createNodeHttpClient} = require('../../lib/stripe');
const {createNodeHttpClient} = require('../../lib/stripe.node');

const {createHttpClientTestSuite, ArrayReadable} = require('./helpers');

Expand Down
7 changes: 5 additions & 2 deletions test/stripe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import {NodeHttpClient} from '../lib/net/NodeHttpClient';
import {getMockPlatformFunctions} from '../testUtils';

const testUtils = require('../testUtils');
const Stripe = require('../lib/stripe');
const stripe = require('../lib/stripe')(testUtils.getUserStripeKey(), 'latest');
const Stripe = require('../lib/stripe.node');
const stripe = require('../lib/stripe.node')(
testUtils.getUserStripeKey(),
'latest'
);
const crypto = require('crypto');

const expect = require('chai').expect;
Expand Down
6 changes: 3 additions & 3 deletions test/telemetry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Client Telemetry', () => {
res.end('{}');
},
(host, port) => {
const stripe = require('../lib/stripe')(
const stripe = require('../lib/stripe.node')(
'sk_test_FEiILxKZwnmmocJDUjUNO6pa',
{
telemetry: false,
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Client Telemetry', () => {
res.end('{}');
},
(host, port) => {
const stripe = require('../lib/stripe')(
const stripe = require('../lib/stripe.node')(
'sk_test_FEiILxKZwnmmocJDUjUNO6pa',
{
telemetry: true,
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('Client Telemetry', () => {
res.end('{}');
},
(host, port) => {
const stripe = require('../lib/stripe')(
const stripe = require('../lib/stripe.node')(
'sk_test_FEiILxKZwnmmocJDUjUNO6pa',
{
telemetry: true,
Expand Down
10 changes: 5 additions & 5 deletions testUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const utils = (module.exports = {
});
server.listen(0, () => {
const {port} = server.address();
const stripe = require('../lib/stripe')(
const stripe = require('../lib/stripe.node')(
module.exports.getUserStripeKey(),
{
host: 'localhost',
Expand All @@ -43,7 +43,7 @@ const utils = (module.exports = {
},

getStripeMockClient: () => {
const stripe = require('../lib/stripe');
const stripe = require('../lib/stripe.node');

return stripe('sk_test_123', {
host: process.env.STRIPE_MOCK_HOST || 'localhost',
Expand Down Expand Up @@ -97,7 +97,7 @@ const utils = (module.exports = {

// Provide a testable stripe instance
// That is, with mock-requests built in and hookable
const stripe = require('../lib/stripe');
const stripe = require('../lib/stripe.node');
const stripeInstance = stripe('fakeAuthToken', config);

stripeInstance._requestSender = new MockRequestSender(
Expand Down Expand Up @@ -165,7 +165,7 @@ const utils = (module.exports = {

// Provide a testable stripe instance
// That is, with mock-requests built in and hookable
const stripe = require('../lib/stripe');
const stripe = require('../lib/stripe.node');
const stripeInstance = stripe('fakeAuthToken', config);

stripeInstance.REQUESTS = [];
Expand All @@ -189,7 +189,7 @@ const utils = (module.exports = {
function CleanupUtility(timeout) {
const self = this;
this._cleanupFns = [];
this._stripe = require('../lib/stripe')(
this._stripe = require('../lib/stripe.node')(
utils.getUserStripeKey(),
'latest'
);
Expand Down

0 comments on commit ecec2f2

Please sign in to comment.